nkarasiak / dzetsaka

dzetsaka : classification plugin for Qgis
GNU General Public License v3.0
80 stars 20 forks source link

Classifying with a trained model fails if a shapefile isn't selected #17

Closed fafasd closed 5 years ago

fafasd commented 5 years ago

When i try to classify a raster file with a trained kNN model and i don't have at least one shapefile available i get the following error:

2019-05-20T09:54:03     WARNING    Traceback (most recent call last):
              File "C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 536, in runMagic
              inShape=inShape.dataProvider().dataSourceUri().split('|')[0] # Remove layerid=0 from SHP Path
             AttributeError: 'NoneType' object has no attribute 'dataProvider'

             During handling of the above exception, another exception occurred:

             Traceback (most recent call last):
              File "C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 556, in runMagic
              QgsMessageLog.logMessage('inShape is : '+inShape)
             TypeError: can only concatenate str (not "NoneType") to str

Having one shapefile available, even if not related to the classification, fixes this somehow.

nkarasiak commented 5 years ago

I have uploaded the version 3.4.5 to the qgis repository, so It should be available very soon in your Qgis. Thanks @fafasd for your feedback :+1: :smile: