1

I am trying to run this script to remove GP History from our SDE geodatabase but I receive the following error:

Runtime error Traceback (most recent call last): File "", line 39, in File "", line 12, in RemoveGpHistory_fd File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\conversion.py", line 1479, in XSLTransform raise e ExecuteError: ERROR 000582: Error occurred during execution.

#Import arcpy module
import arcpy, os, string

def RemoveGpHistory_fd(sdeconn,remove_gp_history_xslt,out_xml):
    arcpy.ClearWorkspaceCache_management()
    for fd in arcpy.ListDatasets():
        arcpy.env.workspace = sdeconn + os.sep + fd
        for fc in arcpy.ListFeatureClasses():
            name_xml = out_xml + os.sep + str(fc) + ".xml"
            #Process: XSLT Transformation
            arcpy.XSLTransform_conversion(sdeconn + os.sep + fd + os.sep + fc, remove_gp_history_xslt, name_xml, "")
            print "Completed xml coversion on {0} {1}".format(fd,fc)
            # Process: Metadata Importer
            arcpy.MetadataImporter_conversion(name_xml,sdeconn + os.sep + fd + os.sep + fc)
            print "Imported XML on {0}".format(fc)

def RemoveGpHistory_fc(sdeconn,remove_gp_history_xslt,out_xml):
    arcpy.ClearWorkspaceCache_management()
    arcpy.env.workspace = sdeconn
    for fx in arcpy.ListFeatureClasses():
        name_xml = out_xml + os.sep + str(fx) + ".xml"
        #Process: XSLT Transformation
        arcpy.XSLTransform_conversion(sdeconn + os.sep + fx, remove_gp_history_xslt, name_xml, "")
        print "Completed xml coversion on {0}".format(fx)
        # Process: Metadata Importer
        arcpy.MetadataImporter_conversion(name_xml,sdeconn + os.sep + fx)
        print "Imported XML on {0}".format(fx)

if __name__== "__main__":
    # Local variables:
    sdeconn = "Database Connections\\NEO_1.sde"
    arcpy.env.workspace = sdeconn
    remove_gp_history_xslt = "C:\\Program Files (x86)\\ArcGIS\Desktop10.5\\Metadata\\Stylesheets\\gpTools\\remove geoprocessing history.xslt"
    out_xml = "C:\\XML_out"
    os.mkdir(out_xml)
    RemoveGpHistory_fd(sdeconn,remove_gp_history_xslt,out_xml)
    RemoveGpHistory_fc(sdeconn,remove_gp_history_xslt,out_xml)
  • What's your OS? – wetland Nov 14 '17 at 13:33
  • @artwork21 OS - Windows Server 2012 R2 – Jordan Nov 14 '17 at 13:38
  • remove_gp_history_xslt directory has an error. After ArcGIS you should use "\\" – wetland Nov 14 '17 at 13:46
  • I added the "\\" but the same error still occurs. I tried this on my windows 7 desktop here at work and it's the same thing – Jordan Nov 14 '17 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.