kreuzrsk

UpgradeMetadata Works As A Model Not In A Script

Discussion created by kreuzrsk on Jan 13, 2012
Latest reply on Feb 22, 2012 by gwalt_blm
We need to run the upgrade metadata on over 100 feature classes in a ArcSDE geodatabase.  I created a simple model to use as an example that I could export just to get the correct syntax.  It runs as a model but not when exported to python.  The code and error message are listed below

# ---------------------------------------------------------------------------
# Upgrade Example.py
# Created on: 2012-01-13 15:59:14.00000
#   (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Local variables:
targetFC = "Database Connections\\myDB.sde\\myDB.DBO.BLMLands"

# Process: Upgrade Metadata
arcpy.UpgradeMetadata_conversion(targetFC, "FGDC_TO_ARCGIS")


------------------
Traceback (most recent call last):
  File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
    exec codeObject in __main__.__dict__
  File "H:\SDE Management\Upgrade Example.py", line 16, in <module>
    arcpy.UpgradeMetadata_conversion(targetFC, "FGDC_TO_ARCGIS")
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\conversion.py", line 656, in UpgradeMetadata
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000816: The tool is not valid.
Failed to execute (UpgradeMetadata).

Outcomes