In VSCode, I typically run a Python Script using the Python extension and right clicking a .py script and selecting "Run Python File in Terminal". Before today this method worked fine, but now I'm experiencing the below issue...
$ & C:/Users/.../Python/Python37-32/python.exe c:/.../test.py
bash: syntax error near unexpected token `&'
Now I can't run my python scripts using this method. I can see the cause of the error, I'm just not sure why VSCode is prefixing that ampersand, and whether it was doing that before or not.
I was playing around with virtualenv, and perhaps this is the cause, but I'm experiencing this issue even when the virtual environment is not active. I've restarted VSCode and my PC, it appears to be broken.
Etymology. The term ampersand is a corruption of and (&) per se and, which literally means "(the character) & by itself (is the word) and." The symbol & is derived from the ligature of ET or et, which is the Latin word for "and."
An ampersand (&) is a typographical symbol that is rarely used in formal writing. It is read aloud as the word and and is used as a substitute for that word in informal writing and in the names of products or businesses.
An ampersand is a symbol (&) representing the word and. The ampersand was included in the Old English alphabet, and the term is an alteration of and per se and.
The ampersand represents the word and. It is actually a ligature (two characters combined) an e and t from the Latin word et, meaning “and”. With many variations, there are two main ways of writing the ampersand: the traditional version (&), and the style that looks more like an E or an et.
Instead of downgrading, you can also change the default terminal from cmd to powershell.
To do so, go to your settings.json and replace the "terminal.integrated.shell.windows"
parameter
from the path to cmd (e.g. "C:\\Windows\\System32\\cmd.exe"
)
to the path to powershell (e.g. "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
)
If you are using VScode press ctrl+shift+p and search for default terminal and change it to powershell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With