Hi there.
I'm not only new to Python, but also to ArcGis and I'm quite stuck trying to create a script to batch convert .e00 files to .shp files.
I've started working with a script that I found in this very own site, but I'm not able to make it work properly. It seems that the first part of the code, where the conversion to coverage files is made, runs fine, but the second part, where the conversion to .shp files should be made, doesn't work. It just does anything.
I don't get any traceback erros. Could you please give me a hint?
<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> os
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> ws <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\in'</SPAN>
out <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\out'</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>exists<SPAN class="punctuation token">(</SPAN>out<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
os<SPAN class="punctuation token">.</SPAN>makedirs<SPAN class="punctuation token">(</SPAN>out<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> cov <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFiles<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'.e00'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ImportFromE00_conversion<SPAN class="punctuation token">(</SPAN>cov<SPAN class="punctuation token">,</SPAN> ws<SPAN class="punctuation token">,</SPAN> cov<SPAN class="punctuation token">.</SPAN>split<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'.'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'Converted %s'</SPAN> <SPAN class="operator token">%</SPAN>cov
<SPAN class="keyword token">for</SPAN> cov <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFiles<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="operator token">not</SPAN> <SPAN class="string token">'.e00'</SPAN> <SPAN class="keyword token">in</SPAN> cov <SPAN class="operator token">and</SPAN> cov <SPAN class="operator token">!=</SPAN> <SPAN class="string token">'info'</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>ws<SPAN class="punctuation token">,</SPAN>cov<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'*polygon'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
shp <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>out<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'%s.shp'</SPAN> <SPAN class="operator token">%</SPAN>cov<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>FeatureClassToFeatureClass_conversion<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN> out<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'Converted Coverage to %s'</SPAN> <SPAN class="operator token">%</SPAN>shp<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>
Thank you so much in advance.