2013-07-23 26 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