Update Cursor with Versioned Enterprise GDB (aka SDE)

458
2
Jump to solution
09-28-2017 10:13 AM
JoeBorgione
MVP Esteemed Contributor

Apparently there is a little gotcha when deploying an arcpy.da.UpdateCursor on a versioned feature class.  This post, The requested operation is invalid on a closed state goes into exactly what I've encountered.  In that same post, Caleb Mackey‌ provides some 'wrapper classes' that he says mitigates the problem.  He imports is module the same way one imports arcpy or numpy at the top of a script.

My question is where do I place his cursors.py module so I can import it and try it?

That should just about do it....
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Does this answer your question:  6.1.2. The Module Search Path — Python 2.7.14 documentation 

I would look into modifying the sys.path.

View solution in original post

2 Replies
JoshuaBixby
MVP Esteemed Contributor

Does this answer your question:  6.1.2. The Module Search Path — Python 2.7.14 documentation 

I would look into modifying the sys.path.

JoeBorgione
MVP Esteemed Contributor

As I followed Joshua's suggestion, I looked here as well ( just 'cuz it was the first hit on my google search)#: How to change sys.path or PYTHONPATH in Python - Ask Xmodulo  which has a couple of ways to change the sys.path.  For example:

import sys
print(sys.path)

Which gives you an idea of where to place such a script.  In my case, I get:

['', u'c:\\program files (x86)\\arcgis\\desktop10.5\\arcpy', 'c:\\program files (x86)\\arcgis\\desktop10.5\\bin', 'c:\\program files (x86)\\arcgis\\desktop10.5\\ArcPy', 'c:\\program files (x86)\\arcgis\\desktop10.5\\ArcToolbox\\Scripts', 'C:\\windows\\SYSTEM32\\python27.zip', 'C:\\Python27\\ArcGIS10.5\\Lib', 'C:\\Python27\\ArcGIS10.5\\DLLs', 'C:\\Python27\\ArcGIS10.5\\Lib\\lib-tk', 'C:\\Users\\JBorgione\\Desktop', 'C:\\Python27\\ArcGIS10.5', 'C:\\Python27\\ArcGIS10.5\\lib\\site-packages']

So there are a ton of places for me to consider...

Joshua Bixby

python arcgis‌ , python; #sys.path

That should just about do it....
0 Kudos