From c5e31acb06bb52358dd0097ebd459f3b9117115c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Tue, 30 Jun 2020 13:17:14 +0200 Subject: [PATCH] Make working_dir yield absolute cwd path --- spacy/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index 4b0bdbae5..f8acebb63 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -462,11 +462,14 @@ def working_dir(path: Union[str, Path]) -> None: """Change current working directory and returns to previous on exit. path (str / Path): The directory to navigate to. + YIELDS (Path): The absolute path to the current working directory. This + should be used if the block needs to perform actions within the working + directory, to prevent mismatches with relative paths. """ prev_cwd = Path.cwd() os.chdir(str(path)) try: - yield + yield Path(path).resolve() finally: os.chdir(prev_cwd)