Hi,
using ArcMap 10.5.
look i want to simply load the data from one gdb to other gdb... but on my first attempt the geometry of polygons and lines was not uploaded. I read in the forums that i needed to include the "SHAPE@". I tried as such, but the result is bad... i cannot understand how to fix it. The error message is: AttributeError: 'unicode' object has no attribute editable.
can someone suggest me something?
cheers
P
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> datasets<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
fcs <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> fcs<SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#print '\t', fc</SPAN>
count<SPAN class="operator token">=</SPAN>count_records<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># counts the features within each FC</SPAN>
<SPAN class="keyword token">if</SPAN> count<SPAN class="operator token"><></SPAN><SPAN class="string token">"0"</SPAN><SPAN class="punctuation token">:</SPAN>
listfields <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> l <SPAN class="keyword token">in</SPAN> range<SPAN class="punctuation token">(</SPAN>len<SPAN class="punctuation token">(</SPAN>listfields<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">## listfields<L> = listfields<L>.name</L></L></SPAN>
<SPAN class="comment token">## print listfields</SPAN>
listfields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>f<SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">for</SPAN> f <SPAN class="keyword token">in</SPAN> listfields <SPAN class="keyword token">if</SPAN> f<SPAN class="punctuation token">.</SPAN>editable <SPAN class="operator token">and</SPAN> f<SPAN class="punctuation token">.</SPAN>type <SPAN class="operator token">!=</SPAN> <SPAN class="string token">"Geometry"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"SHAPE@"</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN>listfields<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cur<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>GDBDwgs <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> fc<SPAN class="punctuation token">,</SPAN> l<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> icur<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cur<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'\t'</SPAN><SPAN class="punctuation token">,</SPAN> fc
icur<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> icur
<SPAN class="keyword token">del</SPAN> cur
<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>