J.S.Orris
J.S.Orris

Reputation: 4821

wxPython: DLL load failed: %1 is not a valid Win32 application

I am brand new to the Python programming language. I am bulding a GUI for a user to be able to automatically transfer files to a folder and then create a file GeoDatabase in ArcCatalog.

I have built a form from a basic template I found online and is as follows:

import wx

class bucky(wx.Frame):

    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Frame aka window', size=(300,200))
        panel=wx.Panel(self)

        box=wx.TextEntryDialog(None, "Whats ur name?", "Title", "default text")
        if box.ShowModal()==wx.ID_OK:
            answer=box.GetValue()

if __name__=='__main__':
    app=wx.SimpleApp()
    frame=bucky(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

Please note that I have Python v2.7 and I have 64-bit Windows OS and have installed the relavant wxPython for 64-bit Windows OS.

I keep getting the following errors when trying to run the program:

Traceback (most recent call last):
  File "C:/Users/xxxxxxxxx/Desktop/Code/Automate/SimpleApp.py", line 1, in <module>
    import wx
  File "C:\Python27\ArcGIS10.2\lib\site-packages\wx-3.0-msw\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\ArcGIS10.2\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.

May somebody please help me troubleshoot this?

Thanks.

Upvotes: 0

Views: 1214

Answers (2)

Def Putra
Def Putra

Reputation: 5

I belive its python 64 bit, try to reinstall with python 32 bit.

Upvotes: 0

Petr Blahos
Petr Blahos

Reputation: 2433

Your installation looks wierd. If I install wxpython, I have it on c:\python27\lib\site-packages\wx-something, but you have some ArcGis10.2 there. My guess is that you installed Python, then you installed ArcGis (whatever may that be) into c:\python27\ArcGis10.2. Now, ArcGis installed it's own Python, so now you have 2 pythons in the system. Then you installed wxPython, which probably let you choose between those 2 interpreters, and you chose the arcgis one. Am I right? :-)

To find out, look if you have files:

c:\python27\python.exe
c:\python27\arcgis10.2\python.exe

I you indeed have these 2 files, then that's it, and I suppose your python was 64 bit, your wx as well, but your arcgis was 32 bit. How to fix it? I would uninstall all 3 if it is still possible, then I would install arcgis and find out if it really has it's own python in it, and what version it is, and then I would try to find the right wx and install.

Upvotes: 3

Related Questions