Dear community,
I am working right now on one ExtractData Script for ArcGIS Server. I actually uses the "ExtractData" Tool form the server Tools.
Meanwhile this script create a zipfolder and within this zipfolder an geodatabase (in%Srcatch% of AGS). Now I try to Add a new Field to the FeatureClass to recalculate the subtypes of the fc. This works fine. When I try to use a update.cursor it works fine on my desktop, but as soon i publish it. I get an ERROR:
ARCGIS Server Manager:
| Error executing tool. Model2 Job ID: jfcb1e7ba32e7428081ca616dbb174c06 : 1 Failed to execute (SubtypeExport). Failed to execute (Model2). Failed to execute (200820_SubtypeExport). |
When I comment the UpdateCursor, my script works fine!
Line
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">releaseDomains</SPAN><SPAN class="punctuation token">(</SPAN>output_gdb<SPAN class="punctuation token">,</SPAN> output_feature_class_name<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> output_gdb
<SPAN class="comment token"># Process: Add Field</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddField_management<SPAN class="punctuation token">(</SPAN>output_feature_class_name<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Oberkategorie_O"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"TEXT"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">9</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"100"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Oberkategorie"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NULLABLE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"REQUIRED"</SPAN><SPAN class="punctuation token">)</SPAN>
desc_lu <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN>
domains <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN>key<SPAN class="punctuation token">,</SPAN> value<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>ListSubtypes<SPAN class="punctuation token">(</SPAN>output_feature_class_name<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>iteritems<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
desc_lu<SPAN class="punctuation token">[</SPAN>key<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> value<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Name'</SPAN><SPAN class="punctuation token">]</SPAN>
dropFields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Hauptkategorie_ST"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#, "Biotopcodes_Unterkategorie")</SPAN>
subtypes <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">for</SPAN> h <SPAN class="keyword token">in</SPAN> desc_lu<SPAN class="punctuation token">:</SPAN>
subtypes<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>h<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> subt <SPAN class="keyword token">in</SPAN> subtypes<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN>output_feature_class_name<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Hauptkategorie_ST"</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"Oberkategorie_O"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>desc_lu<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>
cursor<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ClearWorkspaceCache_management<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Delete the old fields</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>RemoveSubtype_management <SPAN class="punctuation token">(</SPAN>output_feature_class_name<SPAN class="punctuation token">,</SPAN> subtypes<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DeleteField_management<SPAN class="punctuation token">(</SPAN>output_feature_class_name<SPAN class="punctuation token">,</SPAN> dropFields<SPAN class="punctuation token">)</SPAN><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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Any idea? I stuck since 2 weeks on this stup....problem.
Thanks,
Alex
( I attached the whole script)