Skip to content

Commit

Permalink
[processing] show error message instead of Python error if output ras…
Browse files Browse the repository at this point in the history
…ter is temp output and test can not be created
  • Loading branch information
alexbruy committed Oct 6, 2016
1 parent 17010ac commit 45a8441
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/plugins/processing/gui/TestTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from numpy import nan_to_num

from qgis.PyQt.QtCore import QCoreApplication, QMetaObject
from qgis.PyQt.QtWidgets import QDialog, QVBoxLayout, QTextEdit
from qgis.PyQt.QtWidgets import QDialog, QVBoxLayout, QTextEdit, QMessageBox

from processing.core.Processing import Processing
from processing.core.outputs import (
Expand Down Expand Up @@ -232,6 +232,15 @@ def createTest(text):
if isinstance(out, (OutputNumber, OutputString)):
results[out.name] = str(out)
elif isinstance(out, OutputRaster):
if token is None:
QMessageBox.warning(None,
tr('Error'),
tr('Seems some outputs are temporary '
'files. To create test you need to '
'redirect all algorithm outputs to '
'files'))
return

dataset = gdal.Open(token, GA_ReadOnly)
dataArray = nan_to_num(dataset.ReadAsArray(0))
strhash = hashlib.sha224(dataArray.data).hexdigest()
Expand Down

0 comments on commit 45a8441

Please sign in to comment.