0

I wrote script for unzip archive with GDB. It works locally, i.e from ArcMap.

But when I publish scrypt as geoprocessing service, it doesn't work:

ERROR 000714: Error in script Zip22. Error in executing: cmd.exe /C

Script:

import arcpy import os import sys import traceback import zipfile import re class LicenseError(Exception): pass def unzip(zipFileName): try: path = os.path.dirname(zipFileName) zip = zipfile.ZipFile(zipFileName, 'r') gdb_name = None for name in zip.namelist(): if '.gdb' in name.lower(): gdb_name = name.replace('/', os.sep) break if not gdb_name: raise Exception('zip file has no gdb') zip.extractall(path) zip.close() return path + os.sep + gdb_name except RuntimeError: zip.close() arcpy.AddWarning(get_ID_message(86133)) def get_ID_message(ID): return re.sub("%1|%2", "%s", arcpy.GetIDMessage(ID)) if __name__ == '__main__': try: zipFile = arcpy.GetParameterAsText(0) gdb_name = unzip(zipFile) arcpy.SetParameterAsText(1, gdb_name) except: tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] pymsg = "ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n " + str(sys.exc_type) + ": " + str(sys.exc_value) + "\n" arcpy.AddError(pymsg) 

Similar script with archiving GDB to zip works fine both locally and at server.

What's wrong in this script?

1 Answer 1

1

Problem was not in script text, but in script object in ArcMap.

When I checked Run Python script in process and publish this script, it began to work at server too.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.