2

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

1 Answer 1

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.

3
  • 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 Commented Oct 21, 2015 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
    Commented Oct 21, 2015 at 15:19
  • Also, check this thread if you haven't already: geonet.esri.com/thread/14848
    – juturna
    Commented Oct 21, 2015 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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