I am trying to run a python script which is saved on OneDrive. The name of OneDrive is set by my organisation and so I cannot change it.
My problem is when I try to run any script it fails because of the apostrophe. I click on the arrow in vscode to run the file, which results in this bash command: /usr/bin/python3 /Users/username/the organisation's name/Desktop/scripts/mycode.py
In the terminal it just says quote>
and it looks like it’s waiting for input. When I click run again then the second apostrophe closes the quote and I get the output
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/username/the organisations name/Desktop/scripts/mycode.py
/Users/username/theorganisationsname/Desktop/scripts/mycode.py': [Errno 2] No such file or directory
The only way it works is if I type in the terminal: /usr/bin/python3 [path]
and use the esc character for the apostrophy, but it’s not a sustainable solution. I could do an alias I guess, but I’d need to do that for all scripts I have on onedrive. I can also store files locally, not on OneDrive, but I don’t like the idea of being defeated by an apostrophe.
Weirdly when I tried to replicate the problem on my laptop (I created a path /Users/username/Desktop/Code/Julia's folder/test.py
) the code runs fine. The bash command is /usr/bin/python3 "/Users/username/Desktop/Code/Julia's folder/test.py"
– the path is in quotation marks. This doesn’t happen when I run the file saved on onedrive.