Question

Peter Otten __peter__ at web.de
Mon Aug 1 05:14:22 EDT 2011


Camilo Andres Roca Duarte wrote:

> My name is Camilo Roca, I'm a student and recently installed the 2.7.2
> Python version. The problem is that anytime I try to run a script from the
> Python Shell it returns an error message. I am new using python so I am
> not sure what to do since what I'm typing in the shell is in a
> BegginersTutorial.
> 
> $ python myfunctions.py
> SyntaxError: invalid syntax

You shouldn't type the line

$ python myfunctions.py

into Idle's "Python Shell" window. The $ is the prompt of Unix shells like 
bash. You have to open such a shell and type the command there, without the 
leading $.

If you are on Windows you have to open a "DOS Prompt" or "Command Window". 
You can then set the working directory with

cd some\path

Of course you have to replace some\path with the path where the file 
myfunctions.py is actually stored. Finally you can invoke your script with

python myfunctions.py





More information about the Python-list mailing list