Index: helpers.py ================================================================== --- helpers.py +++ helpers.py @@ -10,10 +10,11 @@ class cd: "Context manager for changing the current working directory" def __init__ (self, newPath): self.newPath = os.path.expanduser(newPath) + self.savedPath = "" def __enter__ (self): self.savedPath = os.getcwd() os.chdir(self.newPath) @@ -45,11 +46,11 @@ try: if os.path.isfile(spf): os.unlink(spf) elif os.path.isdir(spf): shutil.rmtree(spf) - except Exception as e: + except (OSError, shutil.Error) as e: print(e) def createCleanFolder (sp): "make an empty folder or erase its content if not empty"