I am making a app that pulls addresses from an Excel sheet (using Openpyxl), turns those addresses into coordinates (using Geocoder), and places a marker at those coordinates on a TkinterMapView.
When I first built it, the map worked perfectly, but then the map just started crashing with the error:
"Max retries exceeded with url"
I don't know if I upgraded or changed something that is causing the issue.
- I've uninstall and reinstall all modules that I use in the app.
- I have destroyed the Virtual Environment that I was working in and pulled everything over to a new Virtual Environment.
- One forum recommended upgrading OpenSSL, which I did, still didn't work.
Any Ideas on how to fix this request issue?
Here's the Code for the Workbook to Geocodes to Marker on Map:
wB = load_workbook('LocationsMM.xlsx')
wS = wB.active
column_C = wS['C']
#-------------------------------------------
CountSet = 0
def SetCounter():
global CountSet
CountSet += 1
for SETcell in column_C:
AddressCellC = SETcell.value
loc = Nominatim(user_agent="Mike")
getSETLoc = loc.geocode(AddressCellC, timeout=10)
getSETLoc_attrib_list = [x for x in dir(getSETLoc) if not x.startswith(('__','__')) and not callable(getattr(getSETLoc, x))]
for atty in getSETLoc_attrib_list:
SETlat1 = getSETLoc.latitude
SETlong1 = getSETLoc.longitude
Marker2 = MAP.set_marker(SETlat1, SETlong1, "SET",
marker_color_circle="white",
marker_color_outside = "red",
text_color = "black",
command = contactInfo)
T = True
while T == True:
SetCounter()
T = False
print("SET", CountSet)
#############################################
#Holding List############################################
wB = load_workbook('HoldingCats(2).xlsx')
wS = wB.active
column_b = wS['B']
#column_Name = wS['A']
#-------------------------------------------
CountHC = 0
def HolcatCounter():
global CountHC
CountHC += 1
for cell in column_b:
AddressCellB = cell.value
loc = Nominatim(user_agent="Mike")
getLoc = loc.geocode(AddressCellB)
getLoc_attrib_list = [x for x in dir(getLoc) if not x.startswith(('__','__')) and not callable(getattr(getLoc, x))]
for atty in getLoc_attrib_list:
lat1 = getLoc.latitude
long1 = getLoc.longitude
Marker1 = MAP.set_marker(lat1, long1, "HolCat",
marker_color_circle="white",
marker_color_outside = "black",
text_color = "black",
command = contactInfo)
T = True
while T == True:
HolcatCounter()
T = False
print("HOLCAT", CountHC)
Here is the ERROR:
/usr/bin/env /Users/jawn/Desktop/c/Locations/bin/python /Users/jawn/
.vscode/extensions/ms-python.debugpy-2024.0.0-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/laun
cher 53842 -- /Users/jawn/Desktop/c/Locations/CC\ Excel3Me.py
2024-02-14 16:38:56.154 Python[86087:674886] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/23/r0y4j88j0t9bktj2bzp_8n3w0000gn/T/org.python.python.savedState
Traceback (most recent call last):
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
conn.connect()
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connection.py", line 782, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 470, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 514, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1046, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1321, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 874, in urlopen
return self.urlopen(
^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 874, in urlopen
return self.urlopen(
^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?q=ADDRESS&format=json&limit=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/geopy/adapters.py", line 482, in _request
resp = self.session.get(url, timeout=timeout, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?q=ADDRESS&format=json&limit=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jawn/Desktop/c/Locations/CC Excel3Me.py", line 399, in <module>
getSETLoc = loc.geocode(AddressCellC, timeout=10)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/geopy/geocoders/nominatim.py", line 297, in geocode
return self._call_geocoder(url, callback, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/geopy/geocoders/base.py", line 368, in _call_geocoder
result = self.adapter.get_json(url, timeout=timeout, headers=req_headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/geopy/adapters.py", line 472, in get_json
resp = self._request(url, timeout=timeout, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jawn/Desktop/c/Locations/lib/python3.12/site-packages/geopy/adapters.py", line 494, in _request
raise GeocoderUnavailable(message)
geopy.exc.GeocoderUnavailable: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?q=ADDRESS&format=json&limit=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))