From: daid303 Date: Thu, 1 Nov 2012 08:07:03 +0000 (+0100) Subject: Better handle plugin exceptions. X-Git-Tag: 13.03~214 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6904a893b7a59d90a0fec091b71fc5bae165ae32;p=cura.git Better handle plugin exceptions. --- diff --git a/Cura/gui/sliceProgessPanel.py b/Cura/gui/sliceProgessPanel.py index 98cd2496..b575a171 100644 --- a/Cura/gui/sliceProgessPanel.py +++ b/Cura/gui/sliceProgessPanel.py @@ -168,7 +168,9 @@ class WorkerThread(threading.Thread): if logLine.startswith('Model error('): gcodefile.write(';%s\n' % (logLine)) gcodefile.close() - profile.runPostProcessingPlugins(gcodeFilename) + ret = profile.runPostProcessingPlugins(gcodeFilename) + if ret != None: + self.progressLog.append(ret) self.gcode = gcodeInterpreter.gcode() self.gcode.load(gcodeFilename) profile.replaceGCodeTags(gcodeFilename, self.gcode) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 0458622d..b59cd8e5 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -612,7 +612,12 @@ def runPostProcessingPlugins(gcodefilename): try: value = float(value) except: - value = 0.0 + value = float(param['default']) locals[param['name']] = value - execfile(pythonFile, locals) + try: + execfile(pythonFile, locals) + except: + locationInfo = traceback.extract_tb(sys.exc_info()[2])[-1] + return "%s: '%s' @ %s:%s:%d" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1]), os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1]) + return None