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?
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.
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:
<SPAN class="keyword token">import</SPAN> sys <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>sys<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
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
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.