Select to view content in your preferred language

Automating Metadata Importing in Python

740
0
10-18-2013 10:08 AM
LinHall
Deactivated User
I am trying to automate importing metadata in Arc Catalog. I want to run this script to use a template for each feature class within a geodatabase.

The error I get in my script is ERROR 000816: The tool is not valid.

I am not quite sure where I have went wrong in this. Here is my code:


import arcpy
#imports the python library into the Arc systems

arcpy.env.workspace = "C:\Users\hallle\Documents\Lin_Metadata\Metadata.gdb"
#sets the workspace that will be used for the script

#arcpy.ImportMetadata_conversion("C:\Users\hallle\Documents\Lin_Metadata\Template.xml","FROM_ISO_19139","Active_Gas_Main")
#imports the metadata template into the desired file

cname = open("C:\Users\hallle\Documents\Lin_Metadata\classnames.txt",'r')
n = 0

for line in cname:
   print line
   arcpy.ImportMetadata_conversion("C:\Users\hallle\Documents\Lin_Metadata\Template.xml","FROM_ISO_19139","C:\Users\hallle\Documents\Lin_Metadata\classnames.txt")
   print 'The name of the file is ' (r)
   n = n + 1

print 'Done'



Also, the two commented lines of code with an import metadata conversion was just there for debugging.

Thanks.
Tags (2)
0 Kudos
0 Replies