This runs in the ArcGIS Python window but not from the IDLE command prompt.
import arcpy
import os
from arcpy import env
env.overwriteOutput = True
arcpy.env.workspace = "D:/Production/MobileData/FireAssets.gdb"
mxdLocation = "D:/Production/MobileData/MobileAssets.mxd"
tempFile = "D:/Production/MobileData/FireMobile_Assets.mpk"
arcpy.PackageMap_management(in_map=mxdLocation, output_file=tempFile, convert_data="CONVERT", convert_arcsde_data="CONVERT_ARCSDE", extent="MAXOF", arcgisruntime="RUNTIME", version="10.2")
This works fine in my ArcMap 10.7 Python Window but fails in IDLE or Python.
This is the error I get:
enter code here
Traceback (most recent call last):
File "D:\Production\MobileData\TEST.py", line 12, in <module>
arcpy.PackageMap_management(in_map=mxdLocation, output_file=tempFile, convert_data="CONVERT", convert_arcsde_data="CONVERT_ARCSDE", extent="MAXOF", arcgisruntime="RUNTIME", version="10.2")
File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\management.py", line 8884, in PackageMap
raise e
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (PackageMap).
This map packages layers from Enterprise geodatabase, FGDB, and a shapefile and exports to a 10.2 runtime map package for our mobile map. The basic script ran fine for years on ArcMap 10.3 - then one day it did not, and we are not sure what update jacked it up.
I ended up upgrading the machine and upgrading to ArcMap 10.7. The script runs in ArcMap python window, but not standalone.
I ran analyzer and corrected all errors for descriptors, tags, etc. I made sure all the layers were using the same connection reference using the find and replace sde connection command. I rebuilt the FGDB for 10.7. I ran check geometry and repaired null values on one layer. All common solutions for PackageMap general error 999999.
I checked the PATH
variables C:\Python27\ArcGISx6410.7
.
I added a set PATH for C:\Python27\ArcGIS10.7 and removed the 64bit path but that was not it. IDLE still launches in 64bit.
I read somewhere that PackageMap will not work with 64-bit background processing and that you need to call the 32-bit version of Python. I tried changing the PATH to C:\Python27\ArcGIS10.7 but IDLE is still running in 64-bit. I tried to find the executable for 32 bit IDLE but had no success. Still researching the correct executable for IDLE 32.
I have learned how to call the script from a DOS CMD prompt and that basically worked by changing my directory to location of 32bit Python and then running myscript.py.
I still want to use 32bit IDLE to test and debug my scripts.
- Can IDLE run in 32-bit after installing a 64bit version?