arcpy error using pyinstaller

851
1
11-13-2017 03:05 AM
williammunsell1
New Contributor

Using pyinstaller, I'm trying to generate an executable file from a python script that utilizes arcpy, however, I keep getting the following error. Any thoughts?

------------------------------------------------------------------------------------------------------------------------------------------------------------

Traceback (most recent call last):

  File "agol_backup_utility.py", line 10, in <module>

    import arcpy

  File "C:\Python27\ArcGIS10.4\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module

    exec(bytecode, module.__dict__)

  File "arcpy\__init__.py", line 22, in <module>

  File "C:\Python27\ArcGIS10.4\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module

    exec(bytecode, module.__dict__)

  File "arcpy\geoprocessing\__init__.py", line 14, in <module>

  File "C:\Python27\ArcGIS10.4\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module

    exec(bytecode, module.__dict__)

  File "arcpy\geoprocessing\_base.py", line 14, in <module>

  File "C:\Python27\ArcGIS10.4\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 688, in load_module

    module = imp.load_module(fullname, fp, filename, ext_tuple)

ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

[7512] Failed to execute script agol_backup_utility

------------------------------------------------------------------------------------------------------------------------------------------------------------

Tags (2)
0 Kudos
1 Reply
DanPatterson_Retired
MVP Esteemed Contributor

yes... arcpy doesn't like to be packaged... in fact there is no dll nor anything else in the distribution by that name.  

It might have a little bit to do with license issues, so your best bet is to separate your workflow into non-arcpy and arcpy stuff, that way, if the person has a legit license, then it will work.  If the person doesn't have arc-anything, then arcpy isn't supposed to be used (but I am sure this is well known in any event)