471,350 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

How to find out if the interpreter is a debug build?

How can i find out if a selected python interpreter (i only know the
path name under which i should start it) is a debug build? I tried

sys.api_version, sys.platform, sys.version, sys.version_info

and there is no difference between "python.exe" and "python_d.exe".
I'm pretty sure the information is stored somewhere but i can't find
it. Please help.

Sep 1 '07 #1
5 1259
In message <11*********************@i13g2000prf.googlegroups. com>, llothar
wrote:
How can i find out if a selected python interpreter (i only know the
path name under which i should start it) is a debug build?
What's the difference in their behaviour?
Sep 1 '07 #2
llothar schrieb:
How can i find out if a selected python interpreter (i only know the
path name under which i should start it) is a debug build? I tried

sys.api_version, sys.platform, sys.version, sys.version_info

and there is no difference between "python.exe" and "python_d.exe".
Sure there is:

if sys.executable.endswith("_d.exe"):
print "Debug version"

If relying on the executable name is too unsafe, you can also look
at imp.get_suffixes(), which includes "_d.pyd" in a debug build on
Windows.

If you want it cross-platform, you can check whether sys.getobjects
is available. That, of course, is also unsafe because there isn't
a single "debug build" on Unix, but instead, several debugging
features can be enabled and disabled separately, so you would have
to specify first what precisely a debug build is.

Regards,
Martin
Sep 1 '07 #3
On 1 Sep., 10:37, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealandwrote:
In message <1188609417.273513.74...@i13g2000prf.googlegroups. com>, llothar
wrote:
How can i find out if a selected python interpreter (i only know the
path name under which i should start it) is a debug build?

What's the difference in their behaviour?
Total different and total incompatible behaviour if you write
an IDE (Debugger/Profiler etc.)

And total different for binary extensions.

Sep 1 '07 #4
On 1 Sep., 13:25, "Martin v. Löwis" <mar...@v.loewis.dewrote:
If you want it cross-platform, you can check whether sys.getobjects
is available. That, of course, is also unsafe because there isn't
a single "debug build" on Unix, but instead, several debugging
features can be enabled and disabled separately, so you would have
to specify first what precisely a debug build is.
I thought that the answer is as complicated as this. At the moment it
would be nice and enough if i only can find out if my binary
extension can be loaded into an interpreter or if this requires a
new extension build.

It is a huge problem and weakness of python if this is impossible
with
debug builds. And if you answer that this is up to the user, i have
to
say, no it isn't: At least if you are like me and are working on an
IDE with a debugger component.
Sep 1 '07 #5
It is a huge problem and weakness of python

Would you like to contribute a patch?

Regards,
Martin
Sep 1 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Rafal Kleger-Rudomin | last post: by
1 post views Thread by Peter Newman | last post: by
21 posts views Thread by Chris Durkin | last post: by
reply views Thread by Simon Eves | last post: by
6 posts views Thread by Andrew Rowley | last post: by
3 posts views Thread by R. Bernstein | last post: by
5 posts views Thread by Erik Hahn | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.