ccrook / QGIS-Contour-Plugin

Contour plugin for QGIS - uses python matplotlib to generate contours of data on vector point data.
43 stars 13 forks source link

Option "Fixed contour interval" crashes in QGIS 3 #29

Closed jmacura closed 6 years ago

jmacura commented 6 years ago

Steps to reproduce:

The plugin crashes immediately after. When the error message is dismissed, the running of both QGIS and Contour plugin continues seamlessly.

System info: Contour plugin 2.0.1 QGIS 3.0.3 Windows 10 (v. 1803)

The error message:

NameError: name 'self' is not defined 
Traceback (most recent call last):
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourDialog.py", line 506, in computeLevels
    self.showLevels()
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourDialog.py", line 512, in showLevels
    levels=self._generator.levels()
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourGenerator.py", line 366, in levels
    self._levels=ContourMethod.calculateLevels(z,method,**params)
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourMethod.py", line 204, in calculateLevels
    return m.calc(z,**params)
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourMethod.py", line 100, in 
    func=lambda z,**kwa: _methodFunc(z,f,name,req,opt,kwa)
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourMethod.py", line 80, in _methodFunc
    return _sortedLevels(f(z,*pav,**kwv))
  File "C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour\ContourMethod.py", line 186, in calcIntervalContours
    .format(nmax-nmin,self.MaxContours))
NameError: name 'self' is not defined

Verze Pythonu: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] 
QGIS verze: 3.0.3-Girona Girona, 8a899c8758 

Python cesta:
C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\contour
C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python
C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins
C:\PROGRA~1\QGIS3~1.0\bin\python36.zip
C:\PROGRA~1\QGIS3~1.0\apps\Python36\DLLs
C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib
C:\PROGRA~1\QGIS3~1.0\bin
C:\PROGRA~1\QGIS3~1.0\apps\Python36
C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages
C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages\Pythonwin
C:/Users/ja/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Alles/works/maps/vizka/podkl
ccrook commented 6 years ago

@jmacura Thanks for your clear reporting of this. I think it is fixed in 2.0.3

The issue comes from the fixed contour option raising an error if more than the specified number of contours would be generated. This is intended behaviour to avoid accidentally generating huge numbers of layers. However the bug was in the code that ran when the error was raised.