Running in Release or Debug version of the python interpreter?
Thomas Heller
theller at python.net
Tue May 24 11:22:16 EDT 2005
Raphael Zulliger schrieb:
> Hi
>
> I have to check wheter a .py script is run within the debug or the
> release version of an embedded python interpreter (in short, wheter
> python24_d.dll or python24.dll is in use).
>
> long version: I'm using ctypes to load my own dll. There exists 2
> version of this dll - a debug and a release version (where one is linked
> against debug C runtime dll and the other to release C runtime dll). Now
> I have to change the name of the dll I want to be loaded by ctypes...
> But how can I find out which of the dll I have to load?!
>
> Thanks in advance!
> Raphael Zulliger
You could use imp.get_suffixes(). In a release build the returned list
will contain these entries
('.pyd', 'rb', 3), ('.dll', 'rb', 3)
in a debug build that will be
('_d.pyd', 'rb', 3), ('_d.dll', 'rb', 3)
Another way would be to look at the filename of any binary extension
module. _ctypes.__file__, for example: '.....\\_ctypes.pyd' vs.
'....\\_ctypes_d.pyd'.
Thomas
More information about the Python-list
mailing list