From 6904a893b7a59d90a0fec091b71fc5bae165ae32 Mon Sep 17 00:00:00 2001 From: daid303 Date: Thu, 1 Nov 2012 09:07:03 +0100 Subject: [PATCH] Better handle plugin exceptions. --- Cura/gui/sliceProgessPanel.py | 4 +++- Cura/util/profile.py | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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 -- 2.30.2