How to debug Python IDLE?

ryguy7272 ryanshuell at gmail.com
Wed Oct 15 15:36:25 EDT 2014


On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote:
> On 10/15/2014 3:09 PM, ryguy7272 wrote:
> 
> > I'm wondering how to debug code in IDLE Python 3.4.  I found this.
> 
> 
> 
> Use 3.4.2, which has an important bugfix for debugger.
> 
> 
> 
> > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html
> 
> >
> 
> > That looks pretty helpful,
> 
> 
> 
> > but mine is nothing like that.  All my controls are greyed out.
> 
> 
> 
> That is normal when you first turn debugger on.  You have to load a file 
> 
> in the editor and then run it (F5).  On the site above, the file is 
> 
> volume.py.  The the debugger is 'activated'.
> 
> 
> 
> -- 
> 
> Terry Jan Reedy


Oh, I didn't know that's how it works.  ok.  Makes sense.  Something is still wrong though.  I have a file named 'test_script.py'.

Here's the code:

def showMaxFactor(num):
     count = num / 2
     while count > 1:
          if num % count == 0:
          print 'largest factor of %d is %d' % \
               (num, count)
          break
          count -= 1
     else:
          print num, "is prime"
     for eachNum in range(10, 21):
          showMaxFactor(eachNum)

With the debugger ON, I hit F5 and get this.
'Expected an indent block'

I wouldn't say that's debugging anything.  I can't tell what line is throwing the error, or how to fix it.

Any thoughts?



More information about the Python-list mailing list