Closed densnow closed 7 months ago
Thanks for spotting. If you fix it for Windows and test on Linux, I can then test on macOS.
Everything in the first comment is true and using a list of args seems to be the best practice, but it did not solve the issue.
In the end I had to replace all instances of "\" with "/" in the temp file path. Windows can accept both as path separators, iand AFAIK "\" are not allowed in filenames or directory names on Windows, mac and Linux.
Using
%allowed
on Windows in Jupyter Notebook prints the following error:It's picking up the
\U
from\Users
as an escape sequence. This appears to be a result of setting theshell=true
arg insubprocess.run()
, and passing the command as a concatenated string which is directly interpreted by the shell (including escape sequences).If we set
shell=false
, we can (Hopefully) bypass the shell, and instead of passing a concatenated string we should pass a list of args starting with the executable.See subprocesses - frequently used arguments for reference.