print details on error msg (e.g. PermissionError on specific file)

This commit is contained in:
svlandeg 2020-06-29 18:22:33 +02:00
parent 894b8e7ff6
commit ff233d5743
2 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ class Warnings(object):
"are currently: da, de, el, en, id, lb, pt, ru, sr, ta, th.")
# TODO: fix numbering after merging develop into master
W091 = ("Could not clean/remove the temp directory at {dir}.")
W091 = ("Could not clean/remove the temp directory at {dir}: {msg}.")
W092 = ("Ignoring annotations for sentence starts, as dependency heads are set.")
W093 = ("Could not find any data to train the {name} on. Is your "
"input data correctly formatted ?")

View File

@ -469,8 +469,8 @@ def make_tempdir():
yield d
try:
shutil.rmtree(str(d))
except PermissionError:
warnings.warn(Warnings.W091.format(dir=d))
except PermissionError as e:
warnings.warn(Warnings.W091.format(dir=d, msg=e))
def get_hash(data) -> str: