AnsweredAssumed Answered

Trouble with py2exe and arcpy / arcgisscripting

Question asked by deleted-user-Me5W-uJw0Ojh on Mar 21, 2013
Latest reply on Apr 22, 2015 by liuyingjie
I'm trying to build an exe using py2exe.  My script uses wxPython for a GUI, and arcpy for an Insert Cursor and an Update Cursor on one table inside of a personal gdb.  I'm using ArcGIS 10.0 and Python 2.6, and Aptana Studio 3 + pyDev as an IDE.

The script works great inside Aptana.  My script executes and creates an EXE file inside of the dist folder of my project directory.  When I try to run the EXE, it crashes on import of arcpy.  The log file shows the following error:

Traceback (most recent call last):   File "", line 66, in <module>   File "zipextimporter.pyo", line 82, in load_module   File "arcpy\__init__.pyo", line 17, in <module>   File "zipextimporter.pyo", line 82, in load_module   File "arcpy\geoprocessing\__init__.pyo", line 14, in <module>   File "zipextimporter.pyo", line 82, in load_module   File "arcpy\geoprocessing\_base.pyo", line 14, in <module>   File "zipextimporter.pyo", line 98, in load_module ImportError: MemoryLoadLibrary failed loading arcgisscripting.pyd

My script looks like this:

from distutils.core import setup import py2exe, sys, os  data_files = ["file1", "file2"]   sys.argv.append('py2exe')  setup(     windows = [{'script': "",'icon_resources':[(1,"icon.ico")]}],     zipfile = None,     data_files=data_files,     options = {'py2exe':                  {                  'includes': "arcgisscripting",                  'bundle_files': 1,                  'dist_dir': "dist",                  'optimize': 2,                 }               }, )

All of the users who will run this EXE will already have ArcGIS 10.0 and Python 2.6.  Is there a way I can specify this in my file?

-- Josh Groeneveld