|
4 | 4 | from sextante.parameters.ParameterRaster import ParameterRaster |
5 | 5 | from sextante.parameters.ParameterVector import ParameterVector |
6 | 6 | from PyQt4 import QtGui |
| 7 | +from PyQt4.QtCore import * |
| 8 | +from qgis.core import * |
7 | 9 | import os.path |
8 | 10 | from sextante.core.SextanteUtils import SextanteUtils |
9 | 11 | from sextante.parameters.ParameterMultipleInput import ParameterMultipleInput |
@@ -117,20 +119,27 @@ def execute(self, progress): |
117 | 119 | except GeoAlgorithmExecutionException, gaee: |
118 | 120 | SextanteLog.addToLog(SextanteLog.LOG_ERROR, gaee.msg) |
119 | 121 | raise gaee |
120 | | - except Exception, e: |
| 122 | + except: |
121 | 123 | #if something goes wrong and is not caught in the algorithm, |
122 | 124 | #we catch it here and wrap it |
123 | | - lines = [] |
124 | | - lines.append(str(e)) |
125 | | - lines.append(traceback.format_exc().replace("\n", "|")) |
| 125 | + lines = ["Uncaught error while executing algorithm"] |
| 126 | + errstring = traceback.format_exc() |
| 127 | + newline = errstring.find("\n") |
| 128 | + if newline != -1: |
| 129 | + lines.append(errstring[:newline]) |
| 130 | + else: |
| 131 | + lines.append(errstring) |
| 132 | + lines.append(errstring.replace("\n", "|")) |
126 | 133 | SextanteLog.addToLog(SextanteLog.LOG_ERROR, lines) |
127 | | - raise GeoAlgorithmExecutionException(str(e)) |
| 134 | + raise GeoAlgorithmExecutionException(errstring) |
128 | 135 |
|
129 | 136 | def checkOutputFileExtensions(self): |
130 | 137 | '''Checks if the values of outputs are correct and have one of the supported output extensions. |
131 | 138 | If not, it adds the first one of the supported extensions, which is assumed to be the default one''' |
132 | 139 | for out in self.outputs: |
133 | 140 | if (not out.hidden) and out.value != None: |
| 141 | + if not os.path.isabs(out.value): |
| 142 | + continue |
134 | 143 | if isinstance(out, OutputRaster): |
135 | 144 | exts = self.provider.getSupportedOutputRasterLayerExtensions() |
136 | 145 | elif isinstance(out, OutputVector): |
@@ -263,3 +272,5 @@ def getAsCommand(self): |
263 | 272 | s+=out.getValueAsCommandLineParameter() + "," |
264 | 273 | s= s[:-1] + ")" |
265 | 274 | return s |
| 275 | + |
| 276 | + |
0 commit comments