Debugging my Python extensions (win32)

Giorgenes Gelatti Gelatti at exatas.unisinos.br
Wed May 15 16:26:39 EDT 2002


Compile your module in debug mode. If you have the problem "pythonxx_d.lib not 
found" do the following:
In every #include <Python.h> you have in your file change it to:
#ifdef _DEBUG
#include <Python.h>
#define _DEBUG
#else
#include <Python.h>
#endif

Well, with your dll linked ok, goto projects/settings menu.
1) In the debug options/Executable for debug section select the python executable 
(eg. c:\python22\python.exe
2) In working directory put the python directory (eg. c:\python22)

Now, just press F5. It will run the python interpreter.
There type "import yourmodule".
This way I can debug my modules easily.

Hope this helps.


> So I've created my Python extension modules, and compiling them in
> release mode I can call into them and all is well... except there is a
> bug in one of the methods. Question: "how do I debug this?" I've tried
> compiling Python in debug mode as well as my extension, but that didn't
> let me put a breakpoint in my extension class. I'm thinking I need to
> compile Python with static libraries (and include my extension in the
> Python executable). This seems like a pain however, so I figured I ask
> if I'm headed in the right direction or if I'm missing something
> simple...
> 
> -- bjorn
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list







More information about the Python-list mailing list