How to debug Python IDLE?
tjreedy at udel.edu
Thu Oct 16 04:21:34 CEST 2014
On 10/15/2014 3:36 PM, ryguy7272 wrote:
Please pay attention to Mark's comment about how to avoid blank line
> def showMaxFactor(num):
> count = num / 2
> while count > 1:
> if num % count == 0:
> print 'largest factor of %d is %d' % \
> (num, count)
> count -= 1
> print num, "is prime"
> for eachNum in range(10, 21):
> With the debugger ON, I hit F5 and get this.
> 'Expected an indent block'
You saw that in a Syntax Error box.
> I wouldn't say that's debugging anything.
Quite the opposite. Idle checks syntax before running the code since
running the code would produce the same error anyway.
> I can't tell what line is throwing the error, or how to fix it.
When you click OK on the box, the editor window is display with the
error marked in red background. In this case, that should be 'print'
with red background. If you indent print and run again, you should, if
running 3.x, see 'Missing parenthesis...' and another red marking.
Terry Jan Reedy
More information about the Python-list