<?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 Download of a file geodatabase failing when using a script and query in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150116#M7197</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I'm trying to download a file geodatabase using a script. The script is taken from the ESRI documentation with minimal changes, basically I'm querying for the required feature layer appending date and time and exporting as a FGDB. The script works as expected by creating the FGDB on AGOL, but when I try and download the FGDB the script fails and fails to export to my local file plan, I can't figure out what is stopping the download, my code is a follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;import datetime as dt&lt;BR /&gt;username = "CSV_GIS_Defects"&lt;BR /&gt;gis = GIS('url','username','password', verify_cert=False, proxy_host='proxy', proxy_port=port)&lt;BR /&gt;folder_path=r'D:\ArcGisExportData\GeoDatabase'&lt;BR /&gt;items = gis.content.search(query="title:CSV_GIS_Defects", item_type="Feature Layer", sort_field='modifed', sort_order='desc')&lt;BR /&gt;print(str(len(items)) + " items will be backed up to " + folder_path +". See the list below:")&lt;BR /&gt;items&lt;/P&gt;&lt;P&gt;def download_as_fgdb(item_list, backup_location):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for item in item_list:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if 'View Service' in item.typeKeywords:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(item.title + " is view, not downloading")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Downloading " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; version = dt.datetime.now().strftime("%d_%b_%Y")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(version)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result = item.export(item.title, "File Geodatabase")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(result)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.download(backup_location)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.delete()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Successfully downloaded " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; except:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("An error occurred downloading " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("The function has completed")&lt;/P&gt;&lt;P&gt;download_as_fgdb(items, folder_path)&lt;/P&gt;&lt;P&gt;The errors I receive in Jupyter&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;1 items will be backed up to D:\ArcGisExportData\GeoDatabase. See the list below:
Downloading CSV_GIS_Defects
03_Mar_2022
&amp;lt;Item title:"CSV_GIS_Defects" type:File Geodatabase owner:shaw_b&amp;gt;
An error occurred downloading CSV_GIS_Defects
The function has completed&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;any help would be greatfully appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2022 14:02:20 GMT</pubDate>
    <dc:creator>BrianShaw</dc:creator>
    <dc:date>2022-03-03T14:02:20Z</dc:date>
    <item>
      <title>Download of a file geodatabase failing when using a script and query</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150116#M7197</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I'm trying to download a file geodatabase using a script. The script is taken from the ESRI documentation with minimal changes, basically I'm querying for the required feature layer appending date and time and exporting as a FGDB. The script works as expected by creating the FGDB on AGOL, but when I try and download the FGDB the script fails and fails to export to my local file plan, I can't figure out what is stopping the download, my code is a follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;import datetime as dt&lt;BR /&gt;username = "CSV_GIS_Defects"&lt;BR /&gt;gis = GIS('url','username','password', verify_cert=False, proxy_host='proxy', proxy_port=port)&lt;BR /&gt;folder_path=r'D:\ArcGisExportData\GeoDatabase'&lt;BR /&gt;items = gis.content.search(query="title:CSV_GIS_Defects", item_type="Feature Layer", sort_field='modifed', sort_order='desc')&lt;BR /&gt;print(str(len(items)) + " items will be backed up to " + folder_path +". See the list below:")&lt;BR /&gt;items&lt;/P&gt;&lt;P&gt;def download_as_fgdb(item_list, backup_location):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for item in item_list:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if 'View Service' in item.typeKeywords:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(item.title + " is view, not downloading")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Downloading " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; version = dt.datetime.now().strftime("%d_%b_%Y")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(version)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result = item.export(item.title, "File Geodatabase")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(result)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.download(backup_location)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result.delete()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("Successfully downloaded " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; except:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("An error occurred downloading " + item.title)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print("The function has completed")&lt;/P&gt;&lt;P&gt;download_as_fgdb(items, folder_path)&lt;/P&gt;&lt;P&gt;The errors I receive in Jupyter&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;1 items will be backed up to D:\ArcGisExportData\GeoDatabase. See the list below:
Downloading CSV_GIS_Defects
03_Mar_2022
&amp;lt;Item title:"CSV_GIS_Defects" type:File Geodatabase owner:shaw_b&amp;gt;
An error occurred downloading CSV_GIS_Defects
The function has completed&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;any help would be greatfully appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 14:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150116#M7197</guid>
      <dc:creator>BrianShaw</dc:creator>
      <dc:date>2022-03-03T14:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Download of a file geodatabase failing when using a script and query</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150457#M7199</link>
      <description>&lt;P&gt;Catching the actual error and displaying that might help you find out what's going wrong (or just remove the try/except statements for testing). Possibly, specifying the file name as well in the download parameters might help here?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 22:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150457#M7199</guid>
      <dc:creator>HuubZwart</dc:creator>
      <dc:date>2022-03-03T22:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Download of a file geodatabase failing when using a script and query</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150595#M7200</link>
      <description>&lt;P&gt;Hi HuubZwart&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Thanks for the response, I removed the try/except block and the error was exposed. I should have thought of it so thanks for the pointer. The error is coming back as an Https proxy timeout, I supply the proxy settings in my connection parameters, they work fine for other scripts my error is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;'Tunnel connection failed: 407 Proxy Authentication Required'&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 04 Mar 2022 08:51:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/download-of-a-file-geodatabase-failing-when-using/m-p/1150595#M7200</guid>
      <dc:creator>BrianShaw</dc:creator>
      <dc:date>2022-03-04T08:51:04Z</dc:date>
    </item>
  </channel>
</rss>

