954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

importing PYD files

You'll have to excuse me, I'm a complete python newbie, but am trying to import a pyd file that I've been sent by a friend. He assures me the file works fine on his computer but when I run

import myfile.pyd


, after having placed the pyd file in the c:\Python\DLLs folder and added the directory to the environment variable, I get the following error

"ImportError: DLL load failed: The specified module could not be found."

I've tried other PYD files from the same directory and they work, so I don't think it's a problem with the directory. Would it matter if my friend compiled this on a different version of Python?

Thanks

dh273
Newbie Poster
4 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

Can you try just import myfile , without the .pyd?

jlm699
Veteran Poster
1,112 posts since Jul 2008
Reputation Points: 355
Solved Threads: 292
 

I've tried that and I get the same error message. Any thoughts?

dh273
Newbie Poster
4 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

try this before the import

import sys
sys.path.append("c:\Python\DLLs")
tyincali
Light Poster
45 posts since Oct 2008
Reputation Points: 31
Solved Threads: 7
 

It could be an issue with the python versions, but that isn't usually the error you get when that is the case.

tyincali
Light Poster
45 posts since Oct 2008
Reputation Points: 31
Solved Threads: 7
 

Excellent - it's now working. Thanks very much for your help, guys

dh273
Newbie Poster
4 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

what was the solution?

tyincali
Light Poster
45 posts since Oct 2008
Reputation Points: 31
Solved Threads: 7
 
what was the solution?


The pyd file must be somewhere in the PYTHONPATH.
So adding the folder like suggested above, did actually added the "DLL" folder to the python path :)

tsmets
Newbie Poster
5 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You