473,545 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

import dll instead of pyd

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!
>>import _mydllpythonmod ule
# trying _mydllpythonmod ule.pyd
# trying _mydllpythonmod ule.py
# trying _mydllpythonmod ule.pyw
# trying _mydllpythonmod ule.pyc
# trying C:\Python25\DLL s\_mydllpythonm odule.pyd
# trying C:\Python25\DLL s\_mydllpythonm odule.py
# trying C:\Python25\DLL s\_mydllpythonm odule.pyw
# trying C:\Python25\DLL s\_mydllpythonm odule.pyc
# trying C:\Python25\lib \_mydllpythonmo dule.pyd
# trying C:\Python25\lib \_mydllpythonmo dule.py
# trying C:\Python25\lib \_mydllpythonmo dule.pyw
# trying C:\Python25\lib \_mydllpythonmo dule.pyc
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyd
# trying C:\Python25\lib \lib-tk\_mydllpython module.py
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyw
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyc
# trying C:\Python25\_my dllpythonmodule .pyd
# trying C:\Python25\_my dllpythonmodule .py
# trying C:\Python25\_my dllpythonmodule .pyw
# trying C:\Python25\_my dllpythonmodule .pyc
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py d
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py w
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py c
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyd
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.py
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyw
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyc
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\win32\ lib\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyc
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\Python win\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named _mydllpythonmod ule
>>>
Jul 25 '08 #1
3 7259
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is this DLL in the same directory as your script? If not, is it part of
your pythonpath? If neither are true, then you won't be able to import
it, regardless of whether it's a good file or not.

jrh wrote:
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!
>>>import _mydllpythonmod ule
# trying _mydllpythonmod ule.pyd
# trying _mydllpythonmod ule.py
# trying _mydllpythonmod ule.pyw
# trying _mydllpythonmod ule.pyc
# trying C:\Python25\DLL s\_mydllpythonm odule.pyd
# trying C:\Python25\DLL s\_mydllpythonm odule.py
# trying C:\Python25\DLL s\_mydllpythonm odule.pyw
# trying C:\Python25\DLL s\_mydllpythonm odule.pyc
# trying C:\Python25\lib \_mydllpythonmo dule.pyd
# trying C:\Python25\lib \_mydllpythonmo dule.py
# trying C:\Python25\lib \_mydllpythonmo dule.pyw
# trying C:\Python25\lib \_mydllpythonmo dule.pyc
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyd
# trying C:\Python25\lib \lib-tk\_mydllpython module.py
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyw
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyc
# trying C:\Python25\_my dllpythonmodule .pyd
# trying C:\Python25\_my dllpythonmodule .py
# trying C:\Python25\_my dllpythonmodule .pyw
# trying C:\Python25\_my dllpythonmodule .pyc
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py d
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py w
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py c
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyd
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.py
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyw
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyc
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\win32\ lib\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyc
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\Python win\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named _mydllpythonmod ule
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki JNGwACgkQLMI5fn dAv9hykgCcDf4cT ZU0iDo+ELQ5aFGs 9FIO
8GEAn3+egrPDtNr lbsssqti8YeZXXI eM
=q31k
-----END PGP SIGNATURE-----
Jul 25 '08 #2
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?

On 25 Juli, 10:03, Nick Dumas <drako...@gmail .comwrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is this DLL in the same directory as your script? If not, is it part of
your pythonpath? If neither are true, then you won't be able to import
it, regardless of whether it's a good file or not.

jrh wrote:
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!
>>import _mydllpythonmod ule
# trying _mydllpythonmod ule.pyd
# trying _mydllpythonmod ule.py
# trying _mydllpythonmod ule.pyw
# trying _mydllpythonmod ule.pyc
# trying C:\Python25\DLL s\_mydllpythonm odule.pyd
# trying C:\Python25\DLL s\_mydllpythonm odule.py
# trying C:\Python25\DLL s\_mydllpythonm odule.pyw
# trying C:\Python25\DLL s\_mydllpythonm odule.pyc
# trying C:\Python25\lib \_mydllpythonmo dule.pyd
# trying C:\Python25\lib \_mydllpythonmo dule.py
# trying C:\Python25\lib \_mydllpythonmo dule.pyw
# trying C:\Python25\lib \_mydllpythonmo dule.pyc
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyd
# trying C:\Python25\lib \lib-tk\_mydllpython module.py
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyw
# trying C:\Python25\lib \lib-tk\_mydllpython module.pyc
# trying C:\Python25\_my dllpythonmodule .pyd
# trying C:\Python25\_my dllpythonmodule .py
# trying C:\Python25\_my dllpythonmodule .pyw
# trying C:\Python25\_my dllpythonmodule .pyc
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py d
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py w
# trying C:\Python25\lib \site-packages\_mydll pythonmodule.py c
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyd
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.py
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyw
# trying C:\Python25\lib \site-packages\win32\ _mydllpythonmod ule.pyc
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\win32\ lib\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\win32\ lib
\_mydllpythonmo dule.pyc
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyd
# trying C:\Python25\lib \site-packages\Python win\_mydllpytho nmodule.py
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyw
# trying C:\Python25\lib \site-packages\Python win
\_mydllpythonmo dule.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named _mydllpythonmod ule

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -http://enigmail.mozdev .org

iEYEARECAAYFAki JNGwACgkQLMI5fn dAv9hykgCcDf4cT ZU0iDo+ELQ5aFGs 9FIO
8GEAn3+egrPDtNr lbsssqti8YeZXXI eM
=q31k
-----END PGP SIGNATURE-----
Jul 25 '08 #3
jrh wrote:
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/NEWS:

- 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
>>import imp
imp.get_suffi xes()
[('.pyd', 'rb', 3), ('.dll', 'rb', 3), ('.py', 'U', 1),
('.pyw', 'U', 1), ('.pyc', 'rb', 2)]

Python 2.5
>>import imp
imp.get_suffi xes()
[('.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>

Jul 25 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3641
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc. And i have things to offer, and to request. And a lot of ideas, but who needs them.... here's an example (from type_struct.py):
4
9348
by: arotem | last post by:
Hi, I am trying to call an unbound method (PrintInput) with the object instance as the first argument but getting the following error: "TypeError: unbound method PrintInput() must be called with test instance as first argument (got test instance instead)" Below is the sample code (test) for this purpose (two files). Any help is greatly...
4
2232
by: Mark Reed | last post by:
Hi all, I have the following code which imports the contents of all files within a set folder which works excellently. Once it has imported from each file, it deletes the file. Is there a way that instead of deleting the file, I can move it to a log somewhere? Private Sub Command0_Click() 'procedure to import all files in a directory and...
16
3092
by: didier.doussaud | last post by:
I have a stange side effect in my project : in my project I need to write "gobal" to use global symbol : .... import math .... def f() : global math # necessary ?????? else next line generate an error message ?????
23
6400
by: Shane Hathaway | last post by:
Here's a heretical idea. I'd like a way to import modules at the point where I need the functionality, rather than remember to import ahead of time. This might eliminate a step in my coding process. Currently, my process is I change code and later scan my changes to make matching changes to the import statements. The scan step is error...
2
1915
by: randar | last post by:
I'm having problems getting an XML document to validate against a fairly complex scenario. Goals: -To have two schemas with two different namespaces, so that I can validate each one seperately against an XML doc. Hence why I'm using xs:import instead of xs:include. -To create some sample XML that will validate in Visual Studio and I can...
3
2174
by: John Salerno | last post by:
I understand that after you import something once, you can reload it to pick up new changes. But does reload work with from statements? I tried this: from X import * and then did my testing. I changed X and tried to reload it, but that didn't seem to work. I figure the reason is because the module itself doesn't exist as an object, only...
2
2560
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made the mistake of running a test program from the same directory where I built and installed my package. Python uses the package from the current...
5
5873
by: Mark A | last post by:
DB2 now comes with a stored procedure called SYSPROC.DB2LOAD that can execute a LOAD, but the IMPORT syntax does not work using the SP. This seems curious to me since a stored procedure is most likely to be used from an application program and the LOAD command requires sysadm, dbadm, or load authority on the entire database. Whereas, IMPORT...
5
1955
by: q3537wh | last post by:
Has anyone encountered a situation where the @import is causing IE 6 to crash? I have a css file, let's call it test.css, that has only two lines in it. @import url("file1.css"); @import url("file2.css"); Both imports were successful in that there were http requests to get
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5351
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.