From a5b74cd77d54bc67620dc84b6db6304bdbad6b21 Mon Sep 17 00:00:00 2001 From: daid Date: Fri, 13 Feb 2015 07:14:06 +0100 Subject: [PATCH] Handle exceptions in the SD replication code. --- Cura/gui/sceneView.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 9547dd0b..00296a19 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -276,15 +276,19 @@ class SceneView(openglGui.glGuiPanel): #check if the file is part of the root folder. If so, create folders on sd card to get the same folder hierarchy. repDir = profile.getPreference("sdcard_rootfolder") - if os.path.exists(repDir) and os.path.isdir(repDir): - repDir = os.path.abspath(repDir) - originFilename = os.path.abspath( self._scene._objectList[0].getOriginFilename() ) - if os.path.dirname(originFilename).startswith(repDir): - filename = os.path.splitext(originFilename[len(repDir):])[0] + profile.getGCodeExtension() - sdPath = os.path.dirname(os.path.join( drive[1], filename)) - if not os.path.exists(sdPath): - print "Creating replication directory:", sdPath - os.makedirs(sdPath) + try: + if os.path.exists(repDir) and os.path.isdir(repDir): + repDir = os.path.abspath(repDir) + originFilename = os.path.abspath( self._scene._objectList[0].getOriginFilename() ) + if os.path.dirname(originFilename).startswith(repDir): + new_filename = os.path.splitext(originFilename[len(repDir):])[0] + profile.getGCodeExtension() + sdPath = os.path.dirname(os.path.join(drive[1], new_filename)) + if not os.path.exists(sdPath): + print "Creating replication directory:", sdPath + os.makedirs(sdPath) + filename = new_filename + except: + pass threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start() elif connectionGroup is not None: -- 2.30.2