scarblac at pino.selwerd.nl
Mon May 21 09:02:10 EDT 2001
Patrick Kirk <pknews at kirks.net> wrote in comp.lang.python:
> I have read that Python is a good first language so I downloaded it and am
> wading through a tutorial. But I'm having silly problems that I can't work
> I run Win2k. Python is in a folder called d:\python. also in there is a
> file called 1.py
> At the command prpmpt, I cd to d:\python run python and enter python 1.py.
> Error message is:
> >>> python 1.py
> File "<stdin>", line 1
> python 1.py
> SyntaxError: invalid syntax
> Clearly I'm doing something wrong but what?
"python 1.py" is a command to run at the command prompt, i.e. *instead of*
running Python the normal way. It's a DOS command.
D:\python> python 1.py
Also, you may get a problem because '1' isn't a valid name for a module. If
you rename it to one.py you'll get fewer problems later on.
On the Python prompt, you can run it with
>>> import one
(if it's called one.py - 'import 1' isn't possible)
Anything in it (like a variable called 'var') can then be accessed:
>>> print one.var
But that's probably later on in the Tutorial.
If you're using the official tutorial as a programming newbie and find it
tough going, note that there are also a few especially for non-programmers,
ie http://www.crosswinds.net/~agauld/ .
More information about the Python-list