1
Python 3.6
アプリケーションで[geopy][1]
を使用していて、Windows 2012 Server
を使用する古いマシンで実行する必要があります。アプリケーションからこのライブラリがこのサーバーで呼び出されたときに、次のエラーが返されるため、問題が発生します。Python ssl.SSLError:証明書の検証に失敗しました(_ssl.c:748)
File "C:\ServAPI\Util.py", line 12, in getLocation
location = geolocator.geocode(name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\geopy\geocoders\osm.py", line 193, in geocode
self._call_geocoder(url, timeout=timeout), exactly_one
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\geopy\geocoders\base.py", line 171, in _call_geocoder
raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
この問題を解決するにはどうすればよいですか?私はWindows 2012 Server
UPDATE
コードにPython 3.6.0
を実行しています。次です:
win2012
がSSL
ライブラリを古いしている可能性がある。最後に
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim()
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))