1

我想将 geograpy3 包用于与位置相关的字符串值的城市和国家映射(如“罗马,意大利”或只是“蒂米什瓦拉”)。它在 OpenSuse 15.3 下的我的 venv 上运行。

不幸的是,我无法与 SQLite DB 相处。我的测试文件总是以如下错误结尾:

sqlite3.OperationalError:没有这样的表...

详细地:

import geograpy
url='https://en.wikipedia.org/wiki/2012_Summer_Olympics_torch_relay'
places = geograpy.get_geoPlace_context(url = url)

print(places)

以。。结束:

Traceback (most recent call last):
  File "/path/to/geograpy3/examples/example1.py", line 3, in <module>
    places = geograpy.get_geoPlace_context(url = url)
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/__init__.py", line 24, in get_geoPlace_context
    places=get_place_context(url, text, labels=Labels.geo, debug=debug)
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/__init__.py", line 46, in get_place_context
    pc = PlaceContext(places)
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/places.py", line 32, in __init__
    self.setAll()
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/places.py", line 87, in setAll
    self.set_countries()
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/places.py", line 98, in set_countries
    country=self.getCountry(place)
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/geograpy/locator.py", line 1162, in getCountry
    countryRecords=self.sqlDB.query(query,params)
  File "/home/axel/.local/share/virtualenvs/myProject-1oLtBMPc/lib/python3.9/site-packages/lodstorage/sql.py", line 183, in query
    query = cur.execute(sqlQuery,params)
sqlite3.OperationalError: no such table: countries

我错过了什么?

4

1 回答 1

1

查看您$HOME/.geograpy3/locations.db的下方,如果文件不存在或为空,请从此处下载。

有关更多信息,请查看此问题:https ://github.com/somnathrakshit/geograpy3/issues/59

于 2021-10-15T08:02:19.423 回答