Reputation
Top tag
Next privilege 250 Rep.
View close votes
Badges
11
Newest
 Critic
Impact
~7k people reached

  • 0 posts edited
  • 0 helpful flags
  • 31 votes cast
Aug
11
comment arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
@PolyGeo The problem was definitely what artwork21 answered below. It was because I was trying to use an UpdateCursor on a text file. It works now. I used arcpy.TableToTable_conversion to convert the text file to an ArcGIS table. The only reason I didn't include the entire code above is because it's quite huge, I know it works otherwise without the above lines of code, and there's too much confidential info in it. It'd take a long time to remove all of that stuff and still have it make sense. Do you have any other suggestions for how I can edit the question to make it more readable?
Aug
10
accepted arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
Aug
10
comment arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
I think you're right. I realized that a bit ago and have been messing with my code. I'm using arcpy.TableToTable_conversion to convert it to a gdb table, exactly like you're proposing.
Aug
10
comment arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
I edited the question to remove the row from (row) (but the script still throws the same error). As for the ObjectID field, it's not the actual OID field. It's a field that references the tables' being compared ObjectID's so that you can perform a join back to the original data. It's actually just a "long" field. In the output, the "real" OID field created is called "OBJECTID_1." It's a little confusing.
Aug
10
revised arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
deleted 3 characters in body
Aug
10
asked arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
Aug
7
comment Why are tool outputs disappearing from the mxd at the end of a python script tool?
I'm marking your answer as correct because it does work, although for anyone interested in how to resolve the adding a text (csv) file to arcmap, see my other post here: gis.stackexchange.com/questions/154723/…
Aug
7
accepted Why are tool outputs disappearing from the mxd at the end of a python script tool?
Aug
7
comment Why are tool outputs disappearing from the mxd at the end of a python script tool?
So sorry for not responding to your answer, I was away for a while, and when I came back I was trying another route (the addOutputsToMap = True route). I was running into an error using what you posted on my other post, but I think after a bajillion iterations it was because I had misspelled TableToTable as TabletoTable. So it's working now!!
Aug
7
comment How do I add a text file to ArcMap using ArcPy?
Yes!! This is working now. Thanks @ian
Aug
7
accepted How do I add a text file to ArcMap using ArcPy?
Aug
7
comment Why are tool outputs disappearing from the mxd at the end of a python script tool?
I pasted a very simplified version of my code for the sake of asking the question about why the output disappears, but my actual code is trying to add an output text file to ArcMap, not a feature class. What you wrote may work for a feature class, but it doesn't work for adding a text file :( Any ideas on how to add a text file at the end of a script? I've tried numerous iterations of "AddLayer" and none of that seems to work for adding a text file. "arcpy.env.addOutputsToMap = True" works, but then my text file disappears.
Aug
6
revised Why are tool outputs disappearing from the mxd at the end of a python script tool?
added 50 characters in body
Aug
6
comment Why are tool outputs disappearing from the mxd at the end of a python script tool?
I've completely updated the question to reflect a full script that is producing the same problem.
Aug
6
revised Why are tool outputs disappearing from the mxd at the end of a python script tool?
Per PolyGeo's suggestion, I'm editing this question to include a much shorter and simpler version of my script, which should hopefully be easier to troubleshoot.
Aug
6
comment Why are tool outputs disappearing from the mxd at the end of a python script tool?
Good suggestions. I just tried them all. I removed the mxd/df variables and mxd.save() leaving only arcpy.env.addOutputsToMap = True (and False). It still adds the data I want to the map, but then after it prints out a message that the script is finished, both data sets still disappear from the map document, one by one. I'm going to write a super short script that does something similar to see if I can pinpoint why this is happening... will check back in after.
Aug
5
asked Why are tool outputs disappearing from the mxd at the end of a python script tool?
Jul
20
comment How do I add a text file to ArcMap using ArcPy?
@ian, sorry to leave you hanging. I still can't get it to work :( I'm still getting an error that the table does not exist or is not supported. Troubleshooting now...
Jul
16
comment How do I add a text file to ArcMap using ArcPy?
@mr.adam AddTableView (arcpy.mapping). How did I miss that? I will try that tomorrow morning and give an update!
Jul
16
revised How do I add a text file to ArcMap using ArcPy?
added 379 characters in body