I'm trying to debug my C extension for Python 2.7. I use python2.7 debug build. I build my project with setuptools
and my setup.py
has such lines:
ext_modules=[Extension("my.extension",
["my/_extension.c"])]
When I invoke python setup.py install
for some reason extension compiles to a file with _d
suffix, and after that, in Python, I can't do import my.extension
, I can only do import my.extension_d
. And what I get is:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/my/extension_d.py", line 7, in <module>
File "build/bdist.linux-x86_64/egg/my/extension_d.py", line 6, in __bootstrap__
ImportError: dynamic module does not define init function (initextension_d)
Of course my extension does not have initextension_d
, it only has initextension
function.
This is very incovenient, because I have to change some code and add this _d
suffix to imports and other stuff.
Is it possible to turn off prepending of this suffix? Or how to deal with that problem in other way? Maybe there are some "official" ways?
UPDATE #0
I use Ubuntu Linux.
linux
. Windows is the only platform that uses_d
for debug builds. See my attempt below to give an answer for the Windows platform (which you may not have meant). – Alginatepython setup.py install
. – Alginatesetup.py
itself and the value ofos.name
. I'm also wondering about the.py
extension. It should by.pyd
or.so
... – Eyla