Runtime error <type 'exceptions.ValueError'>: StandaloneTableObject: Unexpected error
brokenlist = arcpy.mapping.ListBrokenDataSources(mxd) for lyr in brokenlist: if ".sde" in lyr.dataSource: try: lyr.replaceDataSource(new_datasource, "SDE_WORKSPACE", lyr.name)
What version of ArcMap are you using? I ran my script in ArcMap v10.2.0, so maybe ESRI has updated python so it can better handle broken tableview connections in v10.2.2 or v10.3.0. As such, I would log an incident with ESRI.
I will probably be doing this same task, but my organization probably is about a year away from this migration from 10.2.0 to 10.3.1 or 10.4, depending upon when ESRI releases 10.4.
i am in 10.1 we are just now getting to 10.2.2
Thank you
Lela Harrington
Have you thought about going to 10.3 or 10.3.1 (should be out shortly) instead of going to v10.2.2? This item (plus others) might be better handled in this later version.
Do you have any .NET or C# programming experience? You would probably be able to handle this scenario in this programming environment as it is more robust.
no we are in the process of upgrading our servers. we will probably not branch to the 10.3 or 10.4 for a couple more years we are about 2-3 years behind the curve on that.
this is really a one time deal where i just want to get a list of broken data sources and bypass the broken table sources. the except in the script stops it from erroring but not getting the table sourcing stops the script from advancing as well.
Thank you
Lela Harrington
how did you flag the broken tables into a log file?
Lela:
I loop through the TableViews in the dataframe (frm) that has the focus in the mxd that has focus:
#Loop through standalone tables in the focus dataframe
for tab in arcpy.mapping.ListTableViews(mxd, "", frm):
print("The table name in table loop is " + tab.name)
print("The table's datasource is " + tab.dataSource)
print("The table's workspacePath is " + tab.workspacePath)
if tab.workspacePath.endswith(".sde"):
cntTab += 1
if cntTab > 0:
del tab
I then printed out the cntTab to the log file that the script is writing to. I did not have a significant number of TableViews, so manually fixing the ones I found was efficient enough for me. If you have a significant number of TableViews then the manual fix will take much longer (but at least you know where these tables are in your mxds).
That is perfect
Thank you
Lela Harrington