2013-07-23 24 views
0

这里的Python pygeocoder错误是我想在我的Windows机器上的Python 2.6为1.2.1版

from pygeocoder import Geocoder 
results = Geocoder.geocode("Ireland") 
print(results[0].coordinates) 

我已经安装链接(http://code.xster.net/pygeocoder/wiki/Home)pygeocoder运行代码。

试图运行提示错误:

C:\work>TestGeoCode.py 
Traceback (most recent call last): 
File "C:\work\TestGeoCode.py", line 2, in <module> 
results = Geocoder.geocode("Ireland") 
File "c:\python26\lib\site-packages\pygeocoder-1.2.1-py2.6.egg\pygeocoder.py", 
line 160, in geocode 
return GeocoderResult(Geocoder.get_data(params=params)) 
TypeError: Can't instantiate abstract class GeocoderResult with abstract methods 
__next__ 

虽然我的Ubuntu的机器上工作正常。

请问任何人请告诉我为什么会出现这个错误?

感谢 阿布舍克

回答

0

尝试Geocoder.geocode("[Town], [Country]")

+0

仍然没有工作。 – Abhishek

+0

有例子的代码是工作吗? from pygeocoder import Geocoder results = Geocoder.geocode(“Tian'anmen,Beijing”) print(results [0] .coordinates) – Krasimir

+0

我已经试过了他们的例子。但是这个问题依然存在。我只是不知道这个错误消息试图说。 – Abhishek