From 5cfd6016970db2baca22da0e504336d864745dc6 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Fri, 2 Sep 2022 14:06:13 +0900 Subject: [PATCH] shlex.join is only available in 3.8+, so only use when present Fallback is former behaviour of joining with a space. --- spacy/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index 20f95eb66..0c42b1529 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -974,7 +974,11 @@ def run_command( cmd_list = command # As above, this will usually but not always be correct on Windows, but # is only used for debugging purposes. - cmd_str = shlex.join(command) + if hasattr(shlex, "join"): + cmd_str = shlex.join(command) + else: + # shlex.join is more correct, but is only available in 3.8+ + cmd_str = " ".join(command) try: cmd_to_run = command if is_windows else cmd_list ret = subprocess.run(