40 likes | 170 Views
Where is my error?. The IDE will show an error message for syntax errors. In both IDEs there will be some indication of a syntax error found in your code These indications happen ONLY when the code is being executed
E N D
The IDE will show an error message for syntax errors • In both IDEs there will be some indication of a syntax error found in your code • These indications happen ONLY when the code is being executed • So if your code has 2 or more branches, do not assume there are no syntax errors just because it ran correctly ONE time. Make sure your tests go through all possible paths to make sure you have no syntax errors.
For IDLE • Some syntax errors are indicated with a little box that says Syntax Error. To find where it thinks the error is, look back at your source code. • There will be a line (or less!) highlighted. That is the location of the error, according to the interpreter. • If you want to know what line number that is on, (since IDLE does not show the line numbers like WingIDE), look at the lower right corner of the source or edit window, you’ll see the row and column the cursor is on.
According to the interpreter? • Sometimes the interpreter is not right in the location of the error! • It IS correct that there is an error, but it may not be on the line that the interpreter indicates. • Where to look then? • Look at the line indicated, and 2-3 lines above (lesser numbered lines) that location. The error could be there, but the interpreter didn’t understand it was an error until it had seen the next line. • There is no point looking after (below) that location (higher numbered lines) . There may be errors down there but they are not the cause of the current error indicator.