Check in interpreter if running a debug version of python

Brian Curtin brian.curtin at gmail.com
Tue Jul 27 10:42:21 EDT 2010


On Tue, Jul 27, 2010 at 09:06, John Reid <j.reid at mail.cryst.bbk.ac.uk>wrote:

> Can I check in the interpreter if I am running a debug version of python? I
> don't mean if __debug__ is set, I want to know if python was compiled in
> debug mode.
>
> Thanks,
> John.


Starting with Python 2.7 and 3.2 you can do this:

>>> sysconfig.get_config_var("Py_DEBUG")
1

(returns None if the var doesn't exist)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100727/6c923848/attachment-0001.html>


More information about the Python-list mailing list