2024-09-30 16:41:33 发布
网友
我使用的是python模块googlemaps1.0.2,不能在用户输入未知地址的实例中使用try语句。在
我收到的错误消息如下:
GoogleMapsError: Error 602: G_GEO_UNKNOWN_ADDRESS
我的方法如下所示(没有API密钥):
我试过:
except GoogleMapsError: except 'GoogleMapsError: Error 602: G_GEO_UNKNOWN_ADDRESS'
谢谢
你可能还没有导入谷歌地图.GoogleMapsError例外情况。在
from googlemaps import GoogleMaps, GoogleMapsError def get_distance(address, destination): try: gmaps = GoogleMaps(api_key) directions = gmaps.directions(address,destination) distance = directions['Directions']['Distance']['meters']/1600.0 return distance except GoogleMapsError: pass
你可能还没有导入谷歌地图.GoogleMapsError例外情况。在
相关问题 更多 >
编程相关推荐