[python] Solving "DLL load failed: %1 is not a valid Win32 application." for Pygame

I recently installed Python 3.1 and the Pygame module for Python 3.1 When I type import python in the console I get the following error:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import pygame
  File "C:\Python31\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

Please help!

This question is related to python pygame

The answer is


Another possible cause of similar issue could be wrong processorArchitecture in the cx_freeze manifest, trying to load x86 common controls dll in x64 process - should be fixed by this patch:

https://bitbucket.org/anthony_tuininga/cx_freeze/pull-request/71/changed-x86-in-windows-manifest-to/diff


Looks like the question has been long ago answered but the solution did not work for me. When I was getting that error, I was able to fix the problem by downloading PyWin32


I had installed Python 32 bit version and psycopg2 64 bit version to get this problem. I installed psycopg2 32 bit version and then it worked.


Had this issue on Python 2.7.9, solved by updating to Python 2.7.10 (unreleased when this question was asked and answered).