Wednesday, May 14, 2008

Debug Python 3 with Winpdb 1.3.8 Tychod

Thanks to Nir Aides, the developer of Winpdb I have learned how to debug source code of Python 3 in winpdb. There is some trade-off, though:

  1. You must have both Python 2.5 and Python 3 installed.

  2. When installing, wxPython for Python 2.5 (unicode), make sure you have Python 2.5 in the PATH instead of Python 3.

  3. When installing winpdb, make sure to have PATH set back to Python 3. Install winpdb into the directory of Python 3 (otherwise it won't work). (There may be an error message at the end of installation, just ignore it.)

  4. You must run winpdb with Python 2.5 but rpdb with Python 3

In Windows XP, the last step is done like this:

  1. Change PATH from C:\Python30 to C:\Python25

  2. Start new cmd window (otherwise it won't notice the changed PATH)

  3. Run (c:\Python30\Lib\site-packages>)python

  4. Change PATH back to C:\Python30

  5. Start another cmd window (to make it notice the new PATH)

  6. From the winpdb directory run python -pwd=<somePassword> -d <filename> <command line arguments for your python script>

  7. in the GUI window of winpdb do File/Attach and write the password you selected for in the command line

No comments: