geopyを使用していくつかのアドレスをジオコードしています。タイムアウトエラーをキャッチしてプリントアウトして、入力の品質管理をしたいと思います。私はジオコード要求をtry/catchに入れていますが、動作していません。私が何をする必要があるかに関するアイデア?ここでGeopy:キャッチタイムアウトエラー
は私のコードです:
try:
location = geolocator.geocode(my_address)
except ValueError as error_message:
print("Error: geocode failed on input %s with message %s"%(a, error_message))
私は次の例外を取得:
File "/usr/local/lib/python2.7/site-packages/geopy/geocoders/base.py", line 158, in _call_geocoder
raise GeocoderTimedOut('Service timed out')
geopy.exc.GeocoderTimedOut: Service timed out
を事前にありがとうございます!
間違った例外があります。キャッチする必要がある例外は 'GeocoderTimedOut'です。 –