How to find out if the interpreter is a debug build?
"Martin v. Löwis"
martin at v.loewis.de
Sat Sep 1 08:25:25 CEST 2007
> 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:
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
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.
More information about the Python-list