Anyone get python on win98??
Peter Hansen
peter at engcorp.com
Mon Jan 29 00:36:22 EST 2001
shaka wrote:
>
> Ok, I need some help here. I just download python on my computer.
> I installed it to C:\programming\python20
>
> I know how to use the interactive mode. And when write a script I usually
> run it from the editor(idle) by clicking on "run script".
>
> But when I try to run the script using the interpreter, it doesn't work.
> What I do is to type the name of the script.py in the interactive mode. It
> always give me an error message like:
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: There is no variable named 'hello'
>
> Is the interpreter suppose to be in interactive mode everytime?
Sounds like you are trying to do the following in the interpreter:
c:\programming\python20>python
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> hello
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: There is no variable named 'hello'
>>>
This is because you do _not_ execute scripts in the interpreter
that way. The other responses point out how you can run the
script directly from the MS-DOS command prompt, with just
'python hello.py', but this doesn't work when you are in
the interactive mode.
Instead, you could do the following:
>>> import hello
Hello, world
>>>
This is not exactly the same as doing it from the command
prompt, however, and until you understand the differences
you might want to stick with the other method.
> If you have no idea of what I am talking about, can you just describe me how
> you usually run your script.
I just use the command prompt and 'python hello.py' as
the tutorial probably shows.
More information about the Python-list
mailing list