<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Iterate through .gdbs not working anymore in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231166#M17913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message says output is ".shp" but script says it's ".gdb". Perhaps check script to make it is what you think it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than that, try setting the overwriteOutput environment to True:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import os
import arcpy
arcpy.env.overwriteOutput = True
...‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;edit: are you sure this script has ever worked, as written? The second parameter in CopyFeatures should be a feature class, but your script has it as a file geodatabase. See the&amp;nbsp;code samples here for how to use geodatabase feature classes in copy features:&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/copy-features.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/copy-features.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Copy Features—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 11:13:38 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2021-12-11T11:13:38Z</dc:date>
    <item>
      <title>Iterate through .gdbs not working anymore</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231165#M17912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;Had a basic script to iterate through a folder, containing subfolders, then geodatabases, to extract feature classes with a specified name, then append that feature class into a new geodatabase.&amp;nbsp; Worked fine for a bunch of point features, then tried it for a series of line features, and it keeps breaking with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; File "C:\proj\bathy\code\exportcontours.py", line 22, in &amp;lt;module&amp;gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; arcpy.CopyFeatures_management(a, output)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 2586, in CopyFeatures&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; raise e&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR 000725: Output Feature Class: Dataset W:\Gisdata\Fish\Proj\Bathymetry\contourmrg.shp already exists.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Failed to execute (CopyFeatures)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know where this offending shapefile is coming from!&amp;nbsp; Help......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script is as follows:&lt;/P&gt;&lt;P&gt;import os&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;top_folder = r"W:\Gisdata\Fish\Proj\Bathymetry"&lt;BR /&gt;output = r"W:\Gisdata\Fish\Proj\Bathymetry\contourmrg.gdb"&lt;BR /&gt;contlist = [ ]&lt;/P&gt;&lt;P&gt;for path, dirs, files in os.walk(top_folder):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;for d in dirs:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if not d.endswith(".gdb"):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;continue&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gdb_path = os.path.join(path, d)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.env.workspace = gdb_path&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;all_fcs = arcpy.ListFeatureClasses()&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for fds in arcpy.ListDatasets('','feature'):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for fc in arcpy.ListFeatureClasses('','',fds):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;all_fcs.append(fc)&lt;BR /&gt; &lt;BR /&gt; for a in all_fcs:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if a.endswith('contour'):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.CopyFeatures_management(a, output)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contlist.append(a)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print "Exported %s" % a&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;print "Exported the following feature classes %s" % contlist&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2018 15:48:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231165#M17912</guid>
      <dc:creator>DavidSzczebak</dc:creator>
      <dc:date>2018-09-26T15:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through .gdbs not working anymore</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231166#M17913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message says output is ".shp" but script says it's ".gdb". Perhaps check script to make it is what you think it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than that, try setting the overwriteOutput environment to True:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import os
import arcpy
arcpy.env.overwriteOutput = True
...‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;edit: are you sure this script has ever worked, as written? The second parameter in CopyFeatures should be a feature class, but your script has it as a file geodatabase. See the&amp;nbsp;code samples here for how to use geodatabase feature classes in copy features:&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/copy-features.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/copy-features.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Copy Features—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:13:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231166#M17913</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T11:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through .gdbs not working anymore</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231167#M17914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Darren, that's absolutely what it was!&lt;/P&gt;&lt;P&gt;........ I had a path, but no file name for it to write.....&amp;nbsp;&lt;/P&gt;&lt;P&gt;changed&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;arcpy.CopyFeatures_management(a, output)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(a, "%s\%s" % (output, a))&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it works great&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2018 17:40:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-gdbs-not-working-anymore/m-p/231167#M17914</guid>
      <dc:creator>DavidSzczebak</dc:creator>
      <dc:date>2018-09-26T17:40:48Z</dc:date>
    </item>
  </channel>
</rss>

