import dll instead of pyd

J

jrh

Hello,

From previous posts and documentation it seems python should be able
to import a module that is compiled into a .dll just as well as
a .pyd. I have a pyd that works fine, but after renaming it to dll the
import fails. Running python with -vv flag indicates it doesn't
actually look for the dll (see below). Has dll import been defeatured
in python?

Thanks!
# trying _mydllpythonmodule.pyd
# trying _mydllpythonmodule.py
# trying _mydllpythonmodule.pyw
# trying _mydllpythonmodule.pyc
# trying C:\Python25\DLLs\_mydllpythonmodule.pyd
# trying C:\Python25\DLLs\_mydllpythonmodule.py
# trying C:\Python25\DLLs\_mydllpythonmodule.pyw
# trying C:\Python25\DLLs\_mydllpythonmodule.pyc
# trying C:\Python25\lib\_mydllpythonmodule.pyd
# trying C:\Python25\lib\_mydllpythonmodule.py
# trying C:\Python25\lib\_mydllpythonmodule.pyw
# trying C:\Python25\lib\_mydllpythonmodule.pyc
# trying C:\Python25\lib\lib-tk\_mydllpythonmodule.pyd
# trying C:\Python25\lib\lib-tk\_mydllpythonmodule.py
# trying C:\Python25\lib\lib-tk\_mydllpythonmodule.pyw
# trying C:\Python25\lib\lib-tk\_mydllpythonmodule.pyc
# trying C:\Python25\_mydllpythonmodule.pyd
# trying C:\Python25\_mydllpythonmodule.py
# trying C:\Python25\_mydllpythonmodule.pyw
# trying C:\Python25\_mydllpythonmodule.pyc
# trying C:\Python25\lib\site-packages\_mydllpythonmodule.pyd
# trying C:\Python25\lib\site-packages\_mydllpythonmodule.py
# trying C:\Python25\lib\site-packages\_mydllpythonmodule.pyw
# trying C:\Python25\lib\site-packages\_mydllpythonmodule.pyc
# trying C:\Python25\lib\site-packages\win32\_mydllpythonmodule.pyd
# trying C:\Python25\lib\site-packages\win32\_mydllpythonmodule.py
# trying C:\Python25\lib\site-packages\win32\_mydllpythonmodule.pyw
# trying C:\Python25\lib\site-packages\win32\_mydllpythonmodule.pyc
# trying C:\Python25\lib\site-packages\win32\lib
\_mydllpythonmodule.pyd
# trying C:\Python25\lib\site-packages\win32\lib\_mydllpythonmodule.py
# trying C:\Python25\lib\site-packages\win32\lib
\_mydllpythonmodule.pyw
# trying C:\Python25\lib\site-packages\win32\lib
\_mydllpythonmodule.pyc
# trying C:\Python25\lib\site-packages\Pythonwin
\_mydllpythonmodule.pyd
# trying C:\Python25\lib\site-packages\Pythonwin\_mydllpythonmodule.py
# trying C:\Python25\lib\site-packages\Pythonwin
\_mydllpythonmodule.pyw
# trying C:\Python25\lib\site-packages\Pythonwin
\_mydllpythonmodule.pyc
Traceback (most recent call last):
 
J

jrh

Yes it is in the same directory. The problem is it does not seem to
look for dll's at all. So is this by design, or am I missing
something?
 
F

Fredrik Lundh

jrh said:
Yes it is in the same directory. The problem is it does not seem to
look for dll's at all. So is this by design, or am I missing
something?

looks like that was removed in 2.5; from Misc/
- On Windows, .DLL is not an accepted file name extension for
extension modules anymore; extensions are only found if they
end in .PYD.

which is easily confirmed:

Python 2.4.3[('.pyd', 'rb', 3), ('.dll', 'rb', 3), ('.py', 'U', 1),
('.pyw', 'U', 1), ('.pyc', 'rb', 2)]

Python 2.5[('.pyd', 'rb', 3), ('.py', 'U', 1), ('.pyw', 'U', 1),
('.pyc', 'rb', 2)]

(the DLL support was a compatibility thing anyway, so I guess removing
it after 10+ years is a reasonable thing to do...)

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top