Ask user to remove manually a file on exception

This commit is contained in:
Ivan Kravets
2018-10-25 14:03:52 +03:00
parent 75105e18ba
commit fc8bffdd81

View File

@ -839,8 +839,10 @@ def rmtree_(path):
os.remove(name) os.remove(name)
except Exception as e: # pylint: disable=broad-except except Exception as e: # pylint: disable=broad-except
click.secho( click.secho(
"Please manually remove file `%s`" % name, fg="red", err=True) "%s \n\nCould not remove the file `%s`. "
raise e "Please remove it manually." % (str(e), name),
fg="red",
err=True)
return rmtree(path, onerror=_onerror) return rmtree(path, onerror=_onerror)
@ -857,8 +859,7 @@ except ImportError:
magic_check_bytes = re.compile(b'([*?[])') magic_check_bytes = re.compile(b'([*?[])')
def glob_escape(pathname): def glob_escape(pathname):
"""Escape all special characters. """Escape all special characters."""
"""
# Escaping is done by wrapping any of "*?[" between square brackets. # Escaping is done by wrapping any of "*?[" between square brackets.
# Metacharacters do not work in the drive part and shouldn't be # Metacharacters do not work in the drive part and shouldn't be
# escaped. # escaped.