Python debug libraries

R

Robert Ferrell

I'm trying to do some debugging of python extensions on Windows2K. MS
Visual Studio (.NET) says it can't find the debug version of the
python libraries. (The message is "python.exe does not contain any
debugging information".) I installed the binaries from the Windows
installer. How should I get the debug libraries? Or is that even
what I need? I'm kind of new to Windows, and Visual Studio in
particular, so maybe I'm way off base.

thanks,
-robert
 
T

Trent Mick

[Robert Ferrell wrote]
I'm trying to do some debugging of python extensions on Windows2K. MS
Visual Studio (.NET) says it can't find the debug version of the
python libraries. (The message is "python.exe does not contain any
debugging information".) I installed the binaries from the Windows
installer. How should I get the debug libraries? Or is that even
what I need? I'm kind of new to Windows, and Visual Studio in
particular, so maybe I'm way off base.

If you are using the ActivePython distribution the debug libraries are
made available in a separate package here:
ftp://ftp.activestate.com/ActivePython/etc/

For example the debug libs for ActivePython 2.3.2 are:
ActivePython-2.3.2-230-win32-ix86.debug.zip

Cheers,
Trent
 
M

Mike C. Fletcher

See my recent post...

http://groups.google.ca/[email protected]&rnum=2

(all one line). You probably don't want to debug *everything*, just
your particular extension, and this recipe allows that fairly readily
w/out requiring getting every single dependency built against debug
Python (which can be a royal PITA).

HTH,
Mike

Robert said:
I'm trying to do some debugging of python extensions on Windows2K. MS
Visual Studio (.NET) says it can't find the debug version of the
python libraries. (The message is "python.exe does not contain any
debugging information".) I installed the binaries from the Windows
installer. How should I get the debug libraries? Or is that even
what I need? I'm kind of new to Windows, and Visual Studio in
particular, so maybe I'm way off base.

thanks,
-robert
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
 
B

Bryan

Mike said:
See my recent post...

http://groups.google.ca/[email protected]&rnum=2


(all one line). You probably don't want to debug *everything*, just
your particular extension, and this recipe allows that fairly readily
w/out requiring getting every single dependency built against debug
Python (which can be a royal PITA).

HTH,
Mike


_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/

in our company, we do not link to debug third party libraries. i'm embedding python (using visual studio) and run into
the same problem. we now resort to undef'ing _DEBUG before including the python header files and everything works
correctly. if you look in the python header files, you will see that when _DEBUG is defined, there is a #pragma to link
to pythonXX_d.lib. when _DEBUG is not defined it will link to pythonXX.lib. other's may disagree about this approach,
but so far it works well and we don't have any memory problems at all.

for extensions using distutils here's another option which i prefer, since you can do this on a case-by-case basis
instead of modifiying msvccompiler.py:

add this line to setup in your setup.py file:

extra_compile_args = ['/Od /Z7'],
extra_link_args = ['/DEBUG'],

since these options will be placed after the compile/link options that distutils uses, these options will be used,
overriding the options in msvccompiler.py.

bryan
 
B

Bryan

Mike said:
See my recent post...

http://groups.google.ca/[email protected]&rnum=2


(all one line). You probably don't want to debug *everything*, just
your particular extension, and this recipe allows that fairly readily
w/out requiring getting every single dependency built against debug
Python (which can be a royal PITA).

HTH,
Mike


_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/

in our company, we do not link to debug third party libraries. i'm embedding python (using visual studio) and run into
the same problem. we now resort to undef'ing _DEBUG before including the python header files and everything works
correctly. if you look in the python header files, you will see that when _DEBUG is defined, there is a #pragma to link
to pythonXX_d.lib. when _DEBUG is not defined it will link to pythonXX.lib. other's may disagree about this approach,
but so far it works well and we don't have any memory problems at all.

for extensions using distutils here's another option which i prefer, since you can do this on a case-by-case basis
instead of modifiying msvccompiler.py:

add this line to setup in your setup.py file:

extra_compile_args = ['/Od /Z7'],
extra_link_args = ['/DEBUG'],

since these options will be placed after the compile/link options that distutils uses, these options will be used,
overriding the options in msvccompiler.py.

bryan
 
R

Robert Ferrell

[Robert Ferrell wrote]
I'm trying to do some debugging of python extensions on Windows2K. MS
Visual Studio (.NET) says it can't find the debug version of the
python libraries. (The message is "python.exe does not contain any
debugging information".) I installed the binaries from the Windows
installer. How should I get the debug libraries? Or is that even
what I need? I'm kind of new to Windows, and Visual Studio in
particular, so maybe I'm way off base.

If you are using the ActivePython distribution the debug libraries are
made available in a separate package here:
ftp://ftp.activestate.com/ActivePython/etc/

For example the debug libs for ActivePython 2.3.2 are:
ActivePython-2.3.2-230-win32-ix86.debug.zip

I haven't been using ActivePython because I've been using the Enthought
distribution, which includes all the SciPy stuff. Is there any reason
these should be mutally exclusive (they are the same Python version)? Can
I just install ActivePython overtop of another Python distribution?

thanks,
-robert
 
T

Trent Mick

I haven't been using ActivePython because I've been using the Enthought
distribution, which includes all the SciPy stuff. Is there any reason
these should be mutally exclusive (they are the same Python version)? Can
I just install ActivePython overtop of another Python distribution?

You could _try_. :) No guarantees because we certainly don't test that.
ActivePython is fully binary compatible with python.org's Python and I
would presume with Enthought's distro as well, so it should basically
work. You might run into trouble when you start trying to uninstall
everything, though.

Trent
 
R

Robert Ferrell

[Robert Ferrell wrote]
I'm trying to do some debugging of python extensions on Windows2K. MS
Visual Studio (.NET) says it can't find the debug version of the
python libraries. (The message is "python.exe does not contain any
debugging information".) I installed the binaries from the Windows
installer. How should I get the debug libraries? Or is that even
what I need? I'm kind of new to Windows, and Visual Studio in
particular, so maybe I'm way off base.

If you are using the ActivePython distribution the debug libraries are
made available in a separate package here:
ftp://ftp.activestate.com/ActivePython/etc/

For example the debug libs for ActivePython 2.3.2 are:
ActivePython-2.3.2-230-win32-ix86.debug.zip

Okay, I installed ActivePython and the debug libraries. I'm also using
ActiveState's Visual Python. I have a Python driver script which calls
into my Python extension (written in C). How do I get the debugger to
break in the Python script, and then later in my C code? I can get it to
do one or the other by changing which is the "Startup Project". But when
I'm debugging I really need both.

Thanks,
-robert
 
R

Robert Ferrell

See my recent post...

http://groups.google.ca/[email protected]&rnum=2

(all one line). You probably don't want to debug *everything*, just
your particular extension, and this recipe allows that fairly readily
w/out requiring getting every single dependency built against debug
Python (which can be a royal PITA).

I read the post, thanks. Now I have a very novice question. When is
msvccompiler.py used? If I'm building my Python extensions in a MS Visual
Studio project, is that script used?

thanks,
-robert
 
T

Trent Mick

[Robert Ferrell wrote]
I read the post, thanks. Now I have a very novice question. When is
msvccompiler.py used? If I'm building my Python extensions in a MS Visual
Studio project, is that script used?

I am no expert on distutils but that module is a part of the distutils
and is called by the distutils framework _iff you are using distuils to
build your Python extension_.

http://aspn.activestate.com/ASPN/docs/ActivePython/2.3.2/python/dist/dist.html

Trent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,459
Latest member
Vida00R129

Latest Threads

Top