View Full Version : Debugging outside Lightwave/PConsole using Winpdb GUI (win/osx)

10-31-2012, 01:26 AM
Heyo - I got to thinking about debugging Python via a GUI debugger (as others have (http://stackoverflow.com/questions/543196/how-do-i-attach-a-remote-debugger-to-a-python-process)) so I tried it and it appears to work.

I still am a complete Python / LWSDK newb so I haven't debugged anything yet, but I have stopped execution of Modeler via the Winpdb debugger (http://winpdb.org/download/) (download (http://code.google.com/p/winpdb/downloads/detail?name=winpdb-1.4.8.tar.gz&can=1&q=)) and examined the LW Python environment's Locals. See screenshot:


Integration is just a few steps. You install wxPython (http://www.wxpython.org/download.php). On OSX Mountain Lion it's okay to choose the "wxPython2.9-osx-cocoa-py2.7" package, and to install it it's okay to temporarily disable application security to run the PKG:


Extract the Winpdb download and run winpdb:


Copy the "rpdb2" files to a path visible from Lightwave's Python, using commands similar to these:


In Winpdb do a File > Attach and see the empty attach dialog.

Then from Lightwave's embedded Python wait for a connection with the external debugger (http://winpdb.org/docs/embedded-debugging/):


Back in Winpdb hit Refresh on the dialog and see "lwPython" as a local Python environment. Attach to it, and you're in.

NOTE the || (pause) and > (play) buttons - the Lightwave app will start off paused so un-pause it to continue executing.

I don't know how to set breakpoints nor make source code visible to Winpdb but I assume it's not difficult...an exercise left to the more experienced reader (to reply to this post and inform the rest of us!)