我得到了一个错误:TypeError:'NoneType'对象不可读取 当我尝试使用下面的代码摘录对20万个IP进行地理编码时。请注意,当我仅对100K个IP进行地理编码时,不会出现任何错误:
#writing a function that takes index, geocodes the ip individually for multithreading
def new_geocode_ip_ver2(ipandresponse):
if ipandresponse[1]!='0':
match=geolite2.lookup(ipandresponse[0])
if match is not None:
lat, lng = match.location
else:
lat="GC failed"
lng="GC failed"
else:
lat="Non-pingable, no GC"
lng="Non-pingable, no GC"
return lat, lng
#spawn threads for geocoding IPs
pool=ThreadPool(200)
latlng_result=pool.map(new_geocode_ip_ver2,ip_response)
pool.close()
pool.join()
错误信息如下所示。有人能告诉我为什么这个错误发生在100k以上的IP上吗。我正在尝试以这样一种方式来构建我的程序,我将能够对一百万个以上的IP进行地理编码。我是不是有点内存泄露了?在
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐