gshdet

arcpy.ExportMetadata_conversion

Discussion created by gshdet on Jul 10, 2013
Latest reply on Jul 10, 2013 by rzufelt
Hello,

Please can somebody provide some advice?

I have a text file containing the files i would like to export the metadata from e.g. 'D:\Temp\Cost\10_Kilometers_Buffer.shp'

I am trying to loop through this text file and export the metadata for each line. The only issue is on the line arcpy.ExportMetadata_conversion where i get the error

"Failed to execute. Parameters are not valid. ERROR 000732: Source Metadata: Dataset D:\Temp\Cost\10_Kilometers_Buffer.shp
  does not exist or is not supported The value does not exist. ERROR 000732: Source Metadata: Dataset D:\Temp\Cost\10_Kilometers_Buffer.shp does not exist or is not supported Failed to execute (ExportMetadata)."

If i change 'line' to r"D:\Temp\Cost\10_Kilometers_Buffer.shp" it works.

Any help will be greatly appreciated.

James

import arcpy, glob, os, string
import codecs


ListofLayers = codecs.open("C:\\Users\\34459jm\\Desktop\\DirPrnInfo.txt",encoding = 'utf-16')
 
# loop through the translator file
for line in ListofLayers:
 dir = arcpy.GetInstallInfo("desktop\\DirPrnInfo.txt")["InstallDir"]
 translator = dir + "Metadata/Translator/ESRI_ISO2ISO19139.xml"
 arcpy.ExportMetadata_conversion(line, translator, "c:\\Metadata\\" + os.path.basename(line) + ".xml")

Outcomes