Select to view content in your preferred language

How does this metdata Esri script run?

967
2
Jump to solution
07-24-2020 07:18 AM
DaveGrolling1
Occasional Contributor

Trying to impute many metadata elements into an XML using the Esri script supplied here:
Migrating metadata scripts from ArcMap to ArcGIS Pro—Metadata module | Documentation 

I tried copying and pasting into a python script and running that, but though it runs, it doesn't do anything nor produce any errors. Per the documentation, it says "This script is designed to be run as a script tool." So, I then imported this in it's documented state as a script tool in ArcGIS Pro. The only parameter listed in the code is the 'Source_Metadata' argument, so I added just this one parameter to the tool. I tried multiple data types that would prompt me to direct the tool to a XML, or a shapefile, or to a feature class. All failed as soon as I tried running the script tool. Error:

"TypeError: 'geoprocessing value object' object is not iterable"

What do I need to do to take the code listed on this documentation page and get it to run?

0 Kudos
1 Solution

Accepted Solutions
JoshuaSharp-Heward
Frequent Contributor

Hi,

When configuring the script parameter, did you check the box for "Multiple values"? When you do so it returns a list, which is what the function in that metadata script requires as an input (as it is using the input in a for loop). The error message you're getting is a generic Python error which occurs when trying to loop over something that can't be looped.

View solution in original post

0 Kudos
2 Replies
JoshuaSharp-Heward
Frequent Contributor

Hi,

When configuring the script parameter, did you check the box for "Multiple values"? When you do so it returns a list, which is what the function in that metadata script requires as an input (as it is using the input in a for loop). The error message you're getting is a generic Python error which occurs when trying to loop over something that can't be looped.

0 Kudos
DaveGrolling1
Occasional Contributor

Thanks Joshua Sharp-Heward. That worked.  I thought the Multiple Values option was referring to the feature class, not the metadata elements within the feature class. Since I'm only testing with one feature class, I didn't check it.