Debugging Python COM Servers With Winpdb
I have a substantial amount of Python code that needs to talk to the Microsoft world using COM (both as a client and as a server).Â Parts of the Python COM server are pretty slick, such as dynamic dispatch (I use dynamic dispatch to automatically make Python methods whose name match a specific pattern available via COM).
However, it’s much harder to debug a Python COM server.Â In VB6, I can start an out of process COM server from the IDE, wait for clients to connect, and easily use all the VB debugging goodness….
But I can’t do that in Python.Â Most of the time I’ve managed OK by either testing the code via a different non-COM interface or using logging.Â However, I did find a better solution for when I just have to see what’s going on: Winpdb.
Winpdb is a cross-platform (Windows, Linux, and possibly more – not just Windows) remote debugger with a graphical interface.Â I installed it without problems (basically, installed wxPython then Winpdb), and used the embedded debugging feature.Â Just remember to remove the debugging code when you’re done.