<?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: Python script - issues connecting with ArcGIS on semi-regular basis in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1335001#M9099</link>
    <description>&lt;P&gt;Hey Jon,&lt;/P&gt;&lt;P&gt;How are you scheduling your python script? I have seen this issue come up from a user case before.&lt;/P&gt;&lt;P&gt;The resolution to this was scheduling the script from within ArcGIS Pro rather than scheduling it directly with Windows Task Scheduler.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that fixes this for you as well,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 16:21:05 GMT</pubDate>
    <dc:creator>David_McRitchie</dc:creator>
    <dc:date>2023-10-04T16:21:05Z</dc:date>
    <item>
      <title>Python script - issues connecting with ArcGIS on semi-regular basis</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1334709#M9091</link>
      <description>&lt;P&gt;Hi all.&amp;nbsp; I've been tasked with writing a Python script that runs every 5 mins, downloading Surveys from the website to the local server.&amp;nbsp; &amp;nbsp;I have this working (took me a while...) but I continually get connection errors at certain times of day (2:40am), and they continue for several hours before righting themselves.&lt;/P&gt;&lt;P&gt;I've reproduced this on a separate server: both use Arcgis module (2.1.0.3).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Relevant parts..&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;arcgis&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/S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;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;username&lt;/SPAN&gt;&lt;SPAN&gt;=&amp;lt;xxx&amp;gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;password&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;yyy&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;logline&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Connected OK&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;except&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;e&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;logline&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Error opening GIS connection - Error returned is : &amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &lt;/SPAN&gt;&lt;SPAN&gt;str&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;e&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My log shows ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;4/10/2023 08:00:43 : Error opening GIS connection - Error returned is : &amp;gt;A connection error has occurred: HTTPSConnectionPool(host='&lt;A href="http://www.arcgis.com" target="_blank"&gt;www.arcgis.com&lt;/A&gt;', port=443): Max retries exceeded with url: /sharing/rest/generateToken (Caused by ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)))&amp;lt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is this the memory leak problem from this post?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-portal-questions/python-script-error-10054-connection-abort/td-p/516662" target="_blank"&gt;https://community.esri.com/t5/arcgis-enterprise-portal-questions/python-script-error-10054-connection-abort/td-p/516662&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've introduced a periodic garbage collect as per that post's suggestions, but that didn't seem to help.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any other suggestions?&amp;nbsp; &amp;nbsp;(Do I need to explicitly close the connection to the website at the end of each iteration of the script, for example?)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for any suggestions...&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Oct 2023 19:49:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1334709#M9091</guid>
      <dc:creator>Jon_Bryce</dc:creator>
      <dc:date>2023-10-03T19:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python script - issues connecting with ArcGIS on semi-regular basis</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1335001#M9099</link>
      <description>&lt;P&gt;Hey Jon,&lt;/P&gt;&lt;P&gt;How are you scheduling your python script? I have seen this issue come up from a user case before.&lt;/P&gt;&lt;P&gt;The resolution to this was scheduling the script from within ArcGIS Pro rather than scheduling it directly with Windows Task Scheduler.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that fixes this for you as well,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 16:21:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1335001#M9099</guid>
      <dc:creator>David_McRitchie</dc:creator>
      <dc:date>2023-10-04T16:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python script - issues connecting with ArcGIS on semi-regular basis</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1339436#M9171</link>
      <description>&lt;P&gt;Thanks David - it was actually easier than that.&amp;nbsp; The times corresponded exactly with a Veeam backup of that server.&amp;nbsp; &amp;nbsp;I suspect the issue has always been there and we're only just now detecting it (as this is a new script).&amp;nbsp; &amp;nbsp; I've got my Systems Veeam people looking at what's happening there.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wasn't aware that there was a scheduler within ArcGIS Pro - I'll certainly take a look there too.&amp;nbsp; However I'm trying to get this place to move to a centralized scheduling location - right now things are scattered in all sorts of places, and introducing another place would be counter-productive to that proposal.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for the attention and suggestion though.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 02:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-script-issues-connecting-with-arcgis-on/m-p/1339436#M9171</guid>
      <dc:creator>Jon_Bryce</dc:creator>
      <dc:date>2023-10-19T02:44:42Z</dc:date>
    </item>
  </channel>
</rss>

