How to test for 'if arcpy.exists' with RemoveFeatureClassFromTopology stand-alone scr

المشرف العام

Administrator
طاقم الإدارة
I have some datset topologies that i want to loop through, but I need to test for the assignment of feature classes so the scripts dont fail. (Using Win 7, ArcGIS 10.2, Python 2.7.5 and a file GDB)

My research hasnt turned up too much but using the 10.2 "Remove Feature Class From Topology (Data Management)", using ArcCatalog I can remove an existing fc from the topo set. If however I run the script 'stand alone' and the fc isnt currently assigned to the topology, the script fails. (Error shown below script)

I read this post (ArcMap remove feature-class from feature-dataset) as well but I dont want to delete the fc, I only want to remove it from the topo if it exists as I need it again later.

Am i going down the wrong path?

# Using ArcCatalog, this succeeds if the fc exists;topo = "C:/Data/Terrain_36/TOPO_EXPORT_2015_09_09_1_2.gdb/ZONES_1_2/TOPO_1_2"fc = "RL_10"arcpy.RemoveFeatureClassFromTopology_management(topo, fc)# Running this script as 'stand alone', fails if the fc isnt currently assigned;import arcpyfrom arcpy import envtopo = "C:/Data/Terrain_36/TOPO_EXPORT_2015_09_09_1_2.gdb/ZONES_1_2/TOPO_1_2"fc = "RL_10"if arcpy.Exists (fc): arcpy.RemoveFeatureClassFromTopology_management(topo, fc)# My error messagesLog: 2015-09-14 11:48:32.722000Begin process: Topo_script.py Process started at 2015-09-14 11:48:32.722000 PYTHON ERRORS: Traceback info: File "C:\Data\Terrain_36\Data_quality\_Scripts\Topo_script.py", line 62, in arcpy.RemoveFeatureClassFromTopology_management(topo, fc) ArcPy ERRORS: ERROR 999999: Error executing function. Cannot register as versioned on this database. Cannot register as versioned on this database. Failed to execute (RemoveFeatureClassFromTopology).

أكثر...
 
أعلى