Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Trouble with py2exe and arcpy / arcgisscripting

$
0
0
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 setup.py 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:

Code:

Traceback (most recent call last):
  File "redrover-hazus.py", 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 setup.py script looks like this:

Code:

from distutils.core import setup
import py2exe, sys, os

data_files = ["file1", "file2"]


sys.argv.append('py2exe')

setup(
    windows = [{'script': "script.py",'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 setup.py file?

-- Josh Groeneveld

Viewing all articles
Browse latest Browse all 2485

Trending Articles