views:

492

answers:

2

I have access to both a PC and a mac for a python class. I find I am unable to set breakpoints in the IDLE debugger in the mac (works fine on the PC).

I've tried "ctrl-click" and configuring the touchpad to recognize two taps at once as a secondary click. I don't have a mouse for the mac, just the touchpad.

MAC OS 10.4.10 tiger

Python/IDLE version 2.6.1

I have tried STFW unsuccessfully...

+1  A: 

Have a look at the pdb module. I have just barely learned about it, and played with it a bit. It appears to enable command line debugging by allowing you to set traces within the code. This gives you interactive access to your variables and code while it is running. Not quite the same as running the IDLE debugger with breakpoints, but it may work for you.
See this or this for more details.

Something else to look at ... under Options -> Configure IDLE -> Keys, there may be a way to map keystrokes to the action of setting a breakpoint.

ecounysis
+1  A: 

If you put the following two lines:

import pdb
pdb.set_trace()

Python will import the Python De Bugger and you will be in the interactive interpreter at this point in the code. It will evaluate all your Python expressions normally.

The most important commands are:

  1. s - step (forward one command)
  2. c - continue (done)

For a full list, see this: http://infohost.nmt.edu/tcc/help/pubs/python22/pdb-commands.html

rledley
... or just type "help" at the debugger prompt. command-line debugging is something to get used to, but I find it incredibly helpful (I actually use pydb).
ThomasH