import dll instead of pyd

Discussion in 'Python' started by jrh, Jul 25, 2008.

  1. jrh

    jrh Guest

    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):
     
    jrh, Jul 25, 2008
    #1
    1. Advertisements

  2. jrh

    jrh Guest

    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?
     
    jrh, Jul 25, 2008
    #2
    1. Advertisements

  3. 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>
     
    Fredrik Lundh, Jul 25, 2008
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.