Most Basic Question Ever - please help

Stephen Hansen apt.shansen at gmail.com
Sat May 2 17:44:43 EDT 2009


>
> IDLE 2.6.2
> >>> python module1.py
> SyntaxError: invalid syntax
>

The ">>>" prompt is Python's interactive interpreter. Once you are here, you
already are in python-- so typing "python" again is redundant and invalid.
>From this prompt you type in python code.

I have never used IDLE so can't comment on how to get it to run modules and
collect output-- but I suspect when your file is open in IDLE there's a menu
option that says something about Run.

But....


> sean-m-computer:~ seanm$ python
> Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
> [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> python module1.py
>  File "<stdin>", line 1
>    python module1.py
>                 ^
> SyntaxError: invalid syntax
>

Same thing. You're starting python: then doing 'python module1.py' within
Python, which doesn't make sense. If you want Python to run the module, just
do "python module1.py" instead of "python" from your command prompt.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090502/1b41e5b5/attachment.html>


More information about the Python-list mailing list