<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy.ExportMetadata_conversion in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12311#M1009</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Suggest you read this &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000009000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000009000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'\' is an escape character in Python strings, meaning that the path you passed to your tool is trying to do all kinds of crazy stuff. You have three options:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;replace '\' with '\\'&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;replace '\' with '/'&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;specify that the entire string is a regular expression by putting an &lt;STRONG&gt;r&lt;/STRONG&gt; at the start, like so: r'C:\Temp\Projects\shape.shp' (this ignores the escape character)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 20:41:10 GMT</pubDate>
    <dc:creator>StacyRendall1</dc:creator>
    <dc:date>2013-07-10T20:41:10Z</dc:date>
    <item>
      <title>arcpy.ExportMetadata_conversion</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12309#M1007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please can somebody provide some advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Failed to execute. Parameters are not valid. ERROR 000732: Source Metadata: Dataset D:\Temp\Cost\10_Kilometers_Buffer.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 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)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If i change 'line' to r"D:\Temp\Cost\10_Kilometers_Buffer.shp" it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;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")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 09:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12309#M1007</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2013-07-10T09:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ExportMetadata_conversion</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12310#M1008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have fixed the issue by using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ExportMetadata_conversion(line.replace('\r\n',""), translator, "c:\\Metadata\\" + os.path.basename(line.replace('\r\n',"")) + ".xml")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 09:03:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12310#M1008</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2013-07-10T09:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ExportMetadata_conversion</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12311#M1009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Suggest you read this &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000009000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000009000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'\' is an escape character in Python strings, meaning that the path you passed to your tool is trying to do all kinds of crazy stuff. You have three options:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;replace '\' with '\\'&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;replace '\' with '/'&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;specify that the entire string is a regular expression by putting an &lt;STRONG&gt;r&lt;/STRONG&gt; at the start, like so: r'C:\Temp\Projects\shape.shp' (this ignores the escape character)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 20:41:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12311#M1009</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-10T20:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ExportMetadata_conversion</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12312#M1010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, glob, os, string
import codecs


#ListofLayers = codecs.open("C:\\Users\\34459jm\\Desktop\\DirPrnInfo.txt",encoding = 'utf-16')

ListofLayers = arcpy.ListFeatureClasses()

# 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")&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you were to use an arcpy tool to get your list of featureclasses, then using the variable "line" would work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure what you have going on with the DirPrnInfo.txt file that you are extracting from, but if it is for the path/filename information, might want to take a look at arcpy.da.walk.&amp;nbsp; Will give you all in one swoop in a list that can be directly iterated through with your export conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:31:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-exportmetadata-conversion/m-p/12312#M1010</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-10T20:31:42Z</dc:date>
    </item>
  </channel>
</rss>

