anitagraser / QGIS-Processing-tools

This is a collection of scripts and models for QGIS Processing
89 stars 55 forks source link

tanaka_contours.model getting error from Advanced Python field calculator #17

Closed baffioso closed 7 years ago

baffioso commented 7 years ago

I'm getting an error from Advanced Python field calculator on QGIS 2.18.10 running on Ubuntu.

Prepare algorithm: QGISADVANCEDPYTHONFIELDCALCULATOR_1
Running Advanced Python field calculator [3/3]
Parameters: INPUT_LAYER =/tmp/processingcd5f1372acd346a68eaab362769f209d/e8f9491598e54e529b2204495b6d287b/output.shp, FIELD_NAME =azimuth, FIELD_TYPE =0, FIELD_LENGTH =3, FIELD_PRECISION =0, GLOBAL =, FORMULA =p1 = $geom.asPolyline()[0] p2 = $geom.asPolyline()[-1] a = p1.azimuth(p2) if a 
Failed

Error executing algorithm Advanced Python field calculator 'NoneType' object has no attribute 'fields' See log for more details

Here's info from the log:

2017-08-02T22:12:32 2   Uncaught error while executing algorithm
            Traceback (most recent call last):
              File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 203, in execute
                self.processAlgorithm(progress)
              File "/usr/share/qgis/python/plugins/processing/algs/qgis/FieldPyculator.py", line 91, in processAlgorithm
                fields = layer.fields()
            AttributeError: 'NoneType' object has no attribute 'fields'

2017-08-02T22:12:32 2   Error executing algorithm Advanced Python field calculator
            'NoneType' object has no attribute 'fields' 
            See log for more details

Tested the script alone in Advanced Python field calculator where it worked out fine. Seems like something i going wrong when it's running in the model.

Thanks for sharing this model and your inspiring blog.

baffioso commented 7 years ago

Just created the model from scratch in QGIS and got it working.