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

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

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

try this before the import

import sys
sys.path.append("c:\Python\DLLs")

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

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

what was the solution?

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.