From 2fe360d7f3c734c8f7804be6a94a0b6b3f2e53ee Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Fri, 2 Sep 2022 13:23:36 +0900 Subject: [PATCH] Change command used when running on Windows Before this commit the string version of a command was used when running on Windows. This changes it so the input - string or list of strings - is passed directly. In the case the input was a string, nothing changes. In the case the input was a list, Python will internally build a command string such that each element of the list is quoted correctly for Windows exec call. We can't call that method directly because it's considered an implementation detail, see below. https://bugs.python.org/issue10838 An example of when this behavior is correct is if we build a command line list and sys.executable needs to be quoted because it contains spaces or something. Before this change the arguments would just be joined with a space, which would not work. --- spacy/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index f493cff85..fd6e5ea46 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -974,7 +974,7 @@ def run_command( cmd_list = command cmd_str = " ".join(command) try: - cmd_to_run = cmd_str if is_windows else cmd_list + cmd_to_run = command if is_windows else cmd_list ret = subprocess.run( cmd_to_run, env=os.environ.copy(),