I am on Pro version 3.2.0. I am currently working on exporting feature class level metadata to xml files using a custom XSLT. I am currently getting the following error
RuntimeError: Failed to export metadata to 's'
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\utils.py", line 191, in fn_
return fn(*args, **kw)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\metadata.py", line 144, in exportMetadata
return _convertArcObjectToPythonObject(arcgisscripting.metadata.Metadata.exportMetadata(*_gp_fixargs((self, outputPath, metadata_export_option, metadata_removal_option, customStylesheetPath), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\arcobjects\arcobjectconversion.py", line 67, in convertArcObjectToPythonObject
name=type(obj).__name__
SystemError: <class 'type'> returned a result with an error set
My code is attached below.
xslt = r'C:/Documents/Custom.xslt'
if os.path.isfile(xslt):
arcpy.AddMessage("xslt located")
else:
arcpy.AddError("xslt file does not exist")
for fc, fcpath in FCtoFCPath.items():
fcToExport=md.Metadata(fcpath)
fcToExport.exportMetadata(os.path.join(mdir, fc + ".xml"), 'CUSTOM', 'EXACT_COPY', xslt)
If I change the last line of my code to
fcToExport.exportMetadata(os.path.join(mdir, fc + ".xml"), 'FGDC_CSDGM', 'EXACT_COPY')
The script executes without error, but it is not in the format that I need. Has anyone else had this error before, or know what might be causing the error?