rduivenvoorde / featuregridcreator

1 stars 1 forks source link

AttributeError: type object 'UnitType' has no attribute 'Meters' #8

Closed pvandegeer closed 5 years ago

pvandegeer commented 5 years ago

The latest version returns an error as QGis.UnitType.Meters is not recognized.

2019-02-16T15:52:25 1   Traceback (most recent call last):
              File "C:/Users/XXX/.qgis2/python/plugins\FeatureGridCreator\grid_creator.py", line 450, in show_create_features_dialog
                if self.init_create_features_dialog():
              File "C:/Users/XXX/.qgis2/python/plugins\FeatureGridCreator\grid_creator.py", line 489, in init_create_features_dialog
                if layer.crs().mapUnits() != QGis.UnitType.Meters:
            AttributeError: type object 'UnitType' has no attribute 'Meters'

The Python enum is QGis.Meters, see: http://geoapis.sourcepole.com/qgispyapi/qgis#QGis.UnitType

rduivenvoorde commented 5 years ago

Mmm, which version of QGIS are you running? Because in my QGIS 2.18 both work:

gnome-shell-screenshot-fdb0wz

pvandegeer commented 5 years ago

QGis 2.18.28 32-bit on Windows 10

image

m-kuhn commented 5 years ago

Can you compare sip versions too?

rduivenvoorde commented 5 years ago

On Debian I have 4.19.13 (I think?)

Maybe we should show this in About box ?

m-kuhn commented 5 years ago
import sip
sip.SIP_VERSION_STR
rduivenvoorde commented 5 years ago

On Linux: '4.19.13'

On Windows (2.18.27 Osgeo4W install): '4'14'7

m-kuhn commented 5 years ago

Quite some things have changed regarding enums (https://www.riverbankcomputing.com/static/Docs/sip/incompatibilities.html)

I would just stick to the "compatible" version for now

pvandegeer commented 5 years ago

QGis 2.18.28 32-bit on Windows 10

SIP is 4.16.5

rduivenvoorde commented 5 years ago

See version 1.2.2, should be fixed now

pvandegeer commented 5 years ago

Works for me. 👍