threedi / hhnk-threedi-tools

1 stars 0 forks source link

bug in threedi_schema.domain.custom_types.Geometry: version.parse(geoalchemy2.__version__) leads to an packaging.version.InvalidVersion Error as geoalchemy2.__version__ = UNKNOWN_VERSION for geoalchemy2 0.10.2 #16

Closed d2hydro closed 1 year ago

d2hydro commented 1 year ago

In hhnk_research_tools\threedi\grid.py line 45 make_gridadmin is imported:

from threedigrid_builder import make_gridadmin

this leads to: packaging.version.InvalidVersion: Invalid version: 'UNKNOWN VERSION'

reproduce with minimal lines in QGIS python console: from threedi_schema.domain.custom_types import Geometry

Geometry("Point")

d2hydro commented 1 year ago

Issue is verdwenen in huidige versie van de installatie, vermoedelijk; patches\custom_types.py kan worden verwijderd, mocht het probleem zich weer voor doen, dit was de code, waarbij 'if version.parse( ...' was uitgecomment:

class Geometry(geoalchemy2.types.Geometry): cache_ok = False

def __init__(self, geometry_type, from_text="ST_GeomFromEWKT"):
    kwargs = {
        "geometry_type": geometry_type,
        "srid": 4326,
        "spatial_index": True,
        "from_text": from_text,
    }
    # if version.parse(
    #         get_distribution("GeoAlchemy2").version
    #         ) < version.parse("0.13.0"):
    kwargs["management"] = True
    super().__init__(**kwargs)