newbie question

Steve Holden sholden at holdenweb.com
Wed Oct 31 14:19:56 EST 2001


"lance crocker" <jnlc at bellsouth.net> wrote ...
>
> this is an actual exert from a tutorial i got off the net.
>
> Programming tutorials since the beginning of time have started with a
> little program called Hello, World! So here it is:
>
> print "Hello, World!"
>
> If you are using the command line to run programs then type it in with
> a text editor, save it as hello.py and run it with ``python
> hello.py''
>
> Otherwise go into IDLE, create a new window, and create it as in
> section 1.4.
>
> When this program is run here's what it prints:
>
> Hello, World!
>
> i did evrything that it asked me to do but i keep getting syntax
> errors. i tried running it in DOS but it then gives me a bad command
> or file name error.
>
This is because the command processor doesn't know where to find the Python
interpreter. Suppose you have installed Python at the default location
(C:\Python21 for Python version 2.1) then the following command should work,
although requiring a little more typing:

    C:\python21\python hello.py

You can fix this need for extra typing for a single session with the DOS
command

    path c:\python21;%path%

[this adds the Python installation directory to the places that the command
processor looks for programs you tell it to run].

The DOS command

    python hello.py

should now execute your "hello.py" program. To fix it for good you need to
add the command

    path C:\python21;%path%

to a file called "autoexec.bat" in the C:\ directory. The install procedure
would be kinder to newbies if it did this, but undoing such changes at
uninstall time is not always easy so maybe the implementors chose not to do
this.

> I want to get this fixed b/c how can i use progs with out being able
> to run them?

Well, that would be kind of difficult. I know you must be feeling frustrated
right now, but stick with it. You are about to run your very first Python
program!

regards
 Steve
--
www.holdenweb.com






More information about the Python-list mailing list