Derek
Derek

Reputation: 858

Trouble importing python module despite directory appearing in the path

I'm trying to import a module into python but having difficulty.

I have defined the Environment Variable PYTHONPATH which contains C:\MyModules.

I get the following from Python 2.7 when I ask it about the path.

>>> import sys
>>> sys.path
['', 'C:\\MyModules', 'C:\\Python27\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']

C:\MyModules contains the module foo.pyd. I know foo.pyd is a working module because it works on other computers.

When I try to import foo, this happens:

>>> import foo
Traceback (most recent call last):
  File "<string>", line 1, in <fragment>
ImportError: DLL load failed: The specified module could not be found.

What are the possible reasons this might be happening?

Upvotes: 0

Views: 274

Answers (1)

Russell Dias
Russell Dias

Reputation: 73382

You're missing a dependency, run it through Dependency Walker.

As for your question in the comments. I can only assume the module it was trying to import was written in C, which affected Python's backtrace.

Decided to submit this as an answer.

Upvotes: 1

Related Questions