找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 3159|回复: 3

[已回复] 求助

1

主题

2

帖子

2

积分

贫民

积分
2
鱼小鱼 发表于 2018-3-22 11:52:56 | 显示全部楼层 |阅读模式
大神们,菜鸟在做这样的反复读取文本文件内容的循环时,会出现这样读取时间超时的错误,上网搜索了说设置默认时间,但不起作用,请求大神能指点一二么?
02e259e9adfa8e674fac881dd6d4f58.png
c29afcc4228076df88aa58c91608dd8.png

代码和数据.rar

25.81 KB, 下载次数: 2

回复

使用道具 举报

50

主题

1057

帖子

1108

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1108

活跃会员热心会员最佳导师默默耕耘突出贡献优秀版主荣誉管理论坛元老

blueelwang 发表于 2018-3-22 15:15:15 | 显示全部楼层
查了下手册:
设置第三个参数,把timeout设置更大, 是可以解决这个问题的, 如果不行就继续加大这个参数的值

reverse(query, exactly_one=True, timeout=None, distance=None, wkid=4326)
Given a point, find an address.

Parameters:
query (geopy.point.Point, list or tuple of (latitude, longitude), or string as “%(latitude)s, %(longitude)s”.) – The coordinates for which you wish to obtain the closest human-readable addresses.
exactly_one (bool) – Return one result, or a list?
timeout (int) – Time, in seconds, to wait for the geocoding service to respond before raising a geopy.exc.GeocoderTimedOut exception. Set this only if you wish to override, on this call only, the value set during the geocoder’s initialization.
distance (int) – Distance from the query location, in meters, within which to search. ArcGIS has a default of 100 meters, if not specified.
wkid (string) – WKID to use for both input and output coordinates.
回复 支持 反对

使用道具 举报

1

主题

2

帖子

2

积分

贫民

积分
2
鱼小鱼  楼主| 发表于 2018-3-22 15:56:06 | 显示全部楼层
感谢大神指点,修改timeout参数后,程序一次处理的数据更多了,但达到一定数量后又会异常,所以像您说的这个值还得往大了设。
另外请问geolocator = Nominatim()也有这个参数,在这里设是否也会起作用?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表