I'm very new to ArcGIS, and GIS is general. I am trying to build a script that will extract metadata from orthoimagery .tifs. Below is my test code to see if I can get the metadata from one file. It is basically the code from ESRI's docs on arcpy and the metadata toolbox.

import arcpy
from os import path
from arcpy import env    
env.workspace = path.normpath("E:/RESOURCES/TEST_RESOURCES/Pasquotank/TIF/data")    
dir = arcpy.GetInstallInfo("desktop")["InstallDir"]    
translator = dir + path.normpath("Metadata/Translator/ESRI_ISO2ISO19139.xml")    
arcpy.ExportMetadata_conversion(path.normpath("E:/RESOURCES/TEST_RESOURCES/Pasquotank/TIF/data/OC6i0_37_000_20793902_20100411R1.tif"), translator)

When I run this is get the following error.

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000816: The tool is not valid.
Failed to execute (ExportMetadata).

I've tried just using the file name as the first parameter in the ExportMetadata_conversion(), and got the same error.

When I run the tool from ArcCatalog, I get results. So, I'm stuck. I am using ArcGIS 10.0


EDIT: below is a wrong solution. Correct solution linked to here: https://geonet.esri.com/thread/14848

It looks like you are missing an output file in your parameters.

arcpy.ExportMetadata_conversion(path.normpath("E:/RESOURCES/TEST_RESOURCES/Pasquotank/TIF/data/OC6i0_37_000_20793902_20100411R1.tif"), translator, {Output_File})

If I understand the Esri documentation correctly, the output_file is really only optional if your input is a standalone XML file.

  • Same result: arcpy.ExportMetadata_conversion( path.normpath("E:/RESOURCES/TEST_RESOURCES/Pasquotank/TIF/data/OC6i0_37_000_20793902_20100411R1.tif"), translator, path.normpath("E:/RESOURCES/TEST_RESOURCES/Pasquotank/TIF/test.xml")) Thanks for the quick answer – JeremyGibson Oct 21 '15 at 14:56
  • Your initial code works for me using a generic .tif. Note: I'm using ArcGIS 10.3. Have you tried with any other .tif files? – juturna Oct 21 '15 at 15:19
  • Also, check this thread if you haven't already: geonet.esri.com/thread/14848 – juturna Oct 21 '15 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.