From fc8bffdd81302b2edd859d1084d2c0d3f30c08e7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Oct 2018 14:03:52 +0300 Subject: [PATCH] Ask user to remove manually a file on exception --- platformio/util.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index c98320d1..a7dc6516 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -839,8 +839,10 @@ def rmtree_(path): os.remove(name) except Exception as e: # pylint: disable=broad-except click.secho( - "Please manually remove file `%s`" % name, fg="red", err=True) - raise e + "%s \n\nCould not remove the file `%s`. " + "Please remove it manually." % (str(e), name), + fg="red", + err=True) return rmtree(path, onerror=_onerror) @@ -857,8 +859,7 @@ except ImportError: magic_check_bytes = re.compile(b'([*?[])') def glob_escape(pathname): - """Escape all special characters. - """ + """Escape all special characters.""" # Escaping is done by wrapping any of "*?[" between square brackets. # Metacharacters do not work in the drive part and shouldn't be # escaped.