Hi all. I've been tasked with writing a Python script that runs every 5 mins, downloading Surveys from the website to the local server. 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.
I've reproduced this on a separate server: both use Arcgis module (2.1.0.3).
Relevant parts..
..
from arcgis.gis import GIS
..
# Connect to ArcGIS
#
logline("Opening GIS, username >" + <xyz> + "<")
#
try:
gis_connection = GIS(username=<xyz>, password=<yyy>)
logline ("Connected OK")
except Exception as e:
#
logline(
"Error opening GIS connection - Error returned is : >"
+ str(e) + "<" )
My log shows ...
4/10/2023 08:00:43 : Error opening GIS connection - Error returned is : >A connection error has occurred: HTTPSConnectionPool(host='
www.arcgis.com', 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)))<
Is this the memory leak problem from this post?
I've introduced a periodic garbage collect as per that post's suggestions, but that didn't seem to help.
Any other suggestions? (Do I need to explicitly close the connection to the website at the end of each iteration of the script, for example?)
Thanks for any suggestions...