arcpy.management.ExtractPackage failing on ArcGIS Server 10.9

388
0
10-04-2021 01:49 PM
NFlourish
Occasional Contributor

We are trying to run a python script on our ArcGIS Server at the command line. It is failing when it gets to the ExtractPackage procedure call... claiming the parameters are invalid. I've inspected the parameters and they seem legit. The script runs properly as a toolbox script in ArcPro on the same server. So I am wondering if there is some difference in the parameter expectations between calling ExtractPackage() in the server's Python environment versus whatever ArcPro's python environment is?

I realize people might want to troubleshoot by seeing the source code for the script. It is a long script I didn't write, and I'm not sure I can share the source yet. But I can share the few lines that make the call, and show the console output... keeping in mind this works in ArcPro.

arcpy.AddMessage("Extraction Folder: " + extractiondir) # debug message
arcpy.AddMessage(layerpackagelist) # debug message
for layerNum, layerpackage in enumerate(layerpackagelist, start=1):
arcpy.AddMessage("Extracting layer package {}{}".format(layerNum, layerpackage))
arcpy.management.ExtractPackage(in_package = layerpackage, output_folder = extractiondir)
 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from pyt_code import *
>>> foo = RaBETAnalysisTool()
>>> foo.execute(foo.getParameterInfo(),foo.getParameterInfo())
Beginning execution
Extraction Folder: C:\Users\Administrator\Desktop\RaBET_20210730\debugOutput\Nick4\extraction
['C:\\Users\\Administrator\\Documents\\ArcGIS\\Packages\\WC_MLRA_69_2000_2003.lyr_86ceb7\\v104\\0000E__RaBETv7_DEMO_Master_20180923_demo_output_directory_WC_MLRA_69_2000_2003tmp_lyr.lyr', 'C:\\Users\\Administrator\\Documents\\ArcGIS\\Packages\\WC_MLRA_69_2000_2003.lyr_86ceb7\\v104\\0001meta_MLRA_69_2000_2003.lyr']
Extracting layer package 1: C:\Users\Administrator\Documents\ArcGIS\Packages\WC_MLRA_69_2000_2003.lyr_86ceb7\v104\0000E__RaBETv7_DEMO_Master_20180923_demo_output_directory_WC_MLRA_69_2000_2003tmp_lyr.lyr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\arcgispro-py3\pyt_code.py", line 273, in execute arcpy.management.ExtractPackage(in_package = layerpackage, output_folder = extractiondir)
File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\management.py", line 10877, in ExtractPackage raise e
File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\management.py", line 10874, in ExtractPackage retval = convertArcObjectToPythonObject(gp.ExtractPackage_management(*gp_fixargs((in_package, output_folder, cache_package, storage_format_type, create_ready_to_serve_format), True)))
File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in <lambda> return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000814: Invalid file type
Failed to execute (ExtractPackage).

 

Tags (3)
0 Kudos
0 Replies