linz / gazetteer

New Zealand Gazetteer of official place names
http://www.linz.govt.nz/regulatory/place-names/find-name/new-zealand-gazetteer-official-geographic-names/new-zealand-gazetteer-search-place-names#zoom=0&lat=-41.14127&lon=172.5&layers=BTTT
Other
2 stars 2 forks source link

Gazetteer application error: type object `ColumnProperty` has no attribute `ColumnComparator` #77

Closed strk closed 4 years ago

strk commented 4 years ago

Attempts to open the gazetteer application (qgis plugin) results in the error in the subject. This happens with qgis 2.14.3 (hash 393b8292d641).

It was tested via the dockerized qgis and plugin created by the scripts in #76

strk commented 4 years ago

One error printed to the python console, on first click of the button supposedly activating the application is:

Exception AttributeError: "VLayerConnector instance has no attribute 'connection'" in <bound method VLayerConnector.del of <db_manager.db_plugins.vlayers.connector.VLayerConnector instance at 0x7feae4e65098>> ignored

strk commented 4 years ago

More interesting errors printed in the qgis plugins warnings tab:

2020-03-26T11:40:16 1   warning:/usr/share/qgis/python/qgis/utils.py:572: ImportWarning: Not importing directory '/root/.qgis2/python/plugins/NZGBplugin/geoalchemy': missing __init__.py
              mod = _builtin_import(name, globals, locals, fromlist, level)

            traceback:  File "/root/.qgis2/python/plugins/NZGBplugin/Plugin.py", line 208, in _run
                self._createEditor()
              File "/root/.qgis2/python/plugins/NZGBplugin/Plugin.py", line 163, in _createEditor
                from LINZ.gazetteer.gui.Controller import Controller
              File "/usr/share/qgis/python/qgis/utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "/root/.qgis2/python/plugins/NZGBplugin/LINZ/gazetteer/gui/Controller.py", line 21, in <module>
                from LINZ.gazetteer.Model import *
              File "/usr/share/qgis/python/qgis/utils.py", line 572, in _import
                mod = _builtin_import(name, globals, locals, fromlist, level)
              File "/root/.qgis2/python/plugins/NZGBplugin/LINZ/gazetteer/Model.py", line 19, in <module>
                import geoalchemy as ga

It looks like there's a problem with geoalchemy installation, in the docker container

strk commented 4 years ago

Confirmed the problem is unrelated to this plugin, but only to the geoalchemy install. Session from within the docker container built for running qgis into:

root@3f641891cbc8# python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import geoalchemy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/geoalchemy/__init__.py", line 2, in <module>
    from geoalchemy.base import *
  File "/usr/local/lib/python2.7/dist-packages/geoalchemy/base.py", line 242, in <module>
    class SpatialComparator(ColumnProperty.ColumnComparator):
AttributeError: type object 'ColumnProperty' has no attribute 'ColumnComparator'
strk commented 4 years ago

The same problem was reported in geoalchemy in this ticket: https://github.com/geoalchemy/geoalchemy2/issues/88

strk commented 4 years ago

Ah, found: we're using geoalchemy instead of geoalchemy2, and geoalchemy2 is not affected, thus the ticket above was closed. I could not find a ticket for geoalchemy (which seems to be abandoned) -- shall this plugin be ported to geoalchemy2 @ccrook @SPlanzer ?

strk commented 4 years ago

A fix is in this PR: https://github.com/geoalchemy/geoalchemy/pull/35 (but is not merged) -- we could monkey patch the module ourselves, but it would really seem a better idea to me to move forward instead ...

strk commented 4 years ago

Ok I've fixed this issue by documenting that we need sqlalchemy==0.6.0. This issue will be automatically closed by merging PR #76

strk commented 4 years ago

Sorry I was wrong, the requirement was that sqlalchemy is < 0.9, I've updated the PR accordingly, and provided docs and requirements.txt to help getting this right