Skip to content
Permalink
Browse files

[processing] show error message instead of Python error if output ras…

…ter is temp output and test can not be created
  • Loading branch information
alexbruy committed Oct 6, 2016
1 parent 17010ac commit 45a84419ffea466fbc432f2016090d869c36a453
Showing with 10 additions and 1 deletion.
  1. +10 −1 python/plugins/processing/gui/TestTools.py
@@ -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 (
@@ -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()

0 comments on commit 45a8441

Please sign in to comment.
You can’t perform that action at this time.