Search code examples
wxpython

DLL load failure error in wxPython


This is my first time using wxPython Python can go theatre my code

import wx
app=wx.App()
win=wx.Frame(None, -1, 'Window Title')
win.Show()
app.MainLoop()

This is the Error i'm getting:

Traceback (most recent call last):
  File "C:/Users/sancios/Desktop/huluhup", line 1, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: %1 is not a valid Win32 application.

Solution

  • It sounds like you are mixing Python and wxPython versions. They must match. For example, if I have Python 2.7 32-bit, then I need a wxPython 3.0 32-bit for Python 2.7. You cannot install a wxPython that is 64-bit with a Python 32-bit (or vice versa) and expect it to work.