ChangeMyName
ChangeMyName

Reputation: 7418

ImportError: DLL load failed: not a valid Win32 application

I am trying to use Cython to wrap a C++ class. Basically I follow the example at this page.

I'm using Windows7 64-bit, Python 2.7.4 64-bit, MinGW 4.3.3 (32/64bit), and the SDK has been set to x64 mode.

In this case, I successfully build the .pyd file. I tried to import it with following code:

 import sys
 sys.path.append("C:\\Rectangle")
 import rect

The first two lines work well. When I input the third line, it gave following message:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import rect
ImportError: DLL load failed: %1 is not a valid Win32 application.

I compiled the extension in 64bit mode, and every piece of software I used is at least compatible with 64bit. How could such error happened?

May I know how can I work around this?

Many thanks! :-)

Upvotes: 3

Views: 1805

Answers (1)

kaishu
kaishu

Reputation: 59

I ended up switching everything to 32bit (python, wxPython, etc.), and everything is fine now.

So, I would really recommend that you use "file rect.pyd" command to determine if your module is really 64bit.

Upvotes: 1

Related Questions