I have a helloworld.py
containing print("Hello world!")
.
When I try to run it from the command line with python helloworld.py
it gives me an error: The syntax of the command is incorrect.
.
I have python 3.8.2 set up correctly, I get the version when running python --version
and I can use and print statements in the python interpreter.
So what can I do to fix this problem? I'm running Windows 10. And I've removed the aliases like suggested in this thread: https://stackoverflow.com/a/58773979/8029153
I observe the same behavior in Powershell and cmd
.
Output with Powershell:
PS C:\Users\user> cd .\Desktop\...\scripts\
PS C:\Users\user\Desktop\...\scripts> dir
Directory: C:\Users\user\Desktop\...\scripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 28.4.2020 10.07 188 helloworld.py
PS C:\Users\user\Desktop\...\scripts> python helloworld.py
The syntax of the command is incorrect.
Output with plain cmd
:
C:\Users\user\Desktop\...\scripts>dir
Directory of C:\Users\user\Desktop\...\binaries
28.04.2020 10.08 <DIR> .
28.04.2020 10.08 <DIR> ..
28.04.2020 10.07 188 test.py
6 File(s) 9 696 468 bytes
2 Dir(s) 135 932 608 512 bytes free
C:\Users\user\Desktop\...\scripts>python test.py
The syntax of the command is incorrect.
Output of Powershell's get-command
:
PS C:\Users\user\Desktop\...\scripts> get-command python
CommandType Name Version Source
----------- ---- ------- ------
Application python.exe 0.0.0.0 C:\Users\user\AppData\Local\Micros...
Output of where
command:
C:\Users\user\Desktop\...\scripts>where python
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe