r/PythonLearning • u/Turbulent_Photo1840 • Aug 09 '25
Syntax Error Help?
Followed along on the first video on YouTube with Corey Schafer. I don’t know what I’m doing wrong. I added the code in Idle and I keep getting this. Sorry for ignorance, I have no scripting background at all
3
u/cgoldberg Aug 10 '25
You are at a Python interpreter prompt typing arbitrary shell commands. Either type some Python, or exit the prompt (ctrl-d) and run shell commands from a shell.
Also note, some of the commands (--version) are just wrong and won't work anywhere.
1
Aug 09 '25
[removed] — view removed comment
1
u/Turbulent_Photo1840 Aug 09 '25
The black screen is the command prompt?
1
Aug 09 '25
Yes i see you use windows. Press Win+R then type cmd.exe(if the run namespace is empty). Then you are in the right place. Only use the Python Shell >>> prompt for actual Python code, not for terminal commands.
3
u/data15cool Aug 09 '25
I think what’s happened here is that you were trying to get the version of your Python installation with ‘python —version’ but you must’ve pressed enter after typing ‘python’ instead of the full command
What this does is takes you into the Python “shell” which is where you can run Python code. Now you’re typing ‘—version’ and Python doesn’t know what that is (for a number of reasons) and causing errors.
Type ‘exit()’ to get back to the terminal prompt and run the full command
Edit: same for the subsequent commands, you’re trying to run your Python script from within the Python shell rather than the terminal