Hi all:
I've just updated to ArcGIS Pro 2.1.0 and get the following error on code that has been working perfectly well in ArcGIS Pro 2.0.1 for months:
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>inputvesselfile<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SHAPE@X'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SHAPE@Y'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'SHAPE@Z'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SHAPE@M'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> headers<SPAN class="punctuation token">)</SPAN>
count <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> reader<SPAN class="punctuation token">:</SPAN>
newrow <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>float<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> float<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> float<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> int<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> row
line_name <SPAN class="operator token">=</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">6</SPAN><SPAN class="punctuation token">]</SPAN>
cursor<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN>newrow<SPAN class="punctuation token">)</SPAN>
count <SPAN class="operator token">+=</SPAN> <SPAN class="number token">1</SPAN>
<SPAN class="keyword token">if</SPAN> count<SPAN class="operator token">%</SPAN><SPAN class="number token">100</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SetProgressorPosition<SPAN class="punctuation token">(</SPAN>count<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> cursor
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The error I get is:
Traceback (most recent call last):
File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1201, in <module>
main()
File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1196, in main
showGpMessage(logFile)
File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1016, in main
showGpMessage(logFile)
File "D:\roger\Documents\2_scripts_SS\p190_ss.py", line 1009, in main
cursor.insertRow(newrow)
RuntimeError: workspace already in transaction mode
The error is happening on the second iteration of the code block, at cursor.insertRow(newrow).
Can anyone see why it's happening?
If not, can anyone tell me how to roll back to v2.0.1 which was working just fine?
Thanks, Roger