As a short background, I am just starting to learn Python and am familiarizing myself with the whole environment.
Now, I have 3 things open (Windows Vista): Command Prompt, IDLE (Python GUI), and gedit.
On the IDLE, I started typing print commands like so:
>>> print "Print this."
Print this.
>>> run thisfile.py
SyntaxError: invalid syntax
>>> print "Hello world."
Hello world.
Then I saved this file as prac1.py. Now, I opened Command Prompt, went to the directory where this file is saved and typed:
C:\Python27\PythonProjects>prac1.py
But Command Prompt/Terminal displays:
File "C:\Python27\PythonProjects>prac1.py", line 1
Syntax error: invalid syntax
What am I doing wrong? I haven’t typed anything on gedit yet.
Thanks for the answers but just now, I figured out what’s wrong. I should type in the commands inside gedit (editor) and not inside IDLE. But I’ll also try other ways to run the file like what you guys suggested. 😉