New guy question

John Roth johnroth at ameritech.net
Mon Jun 11 00:10:55 CEST 2001


"Glen Mettler" <Glen.Mettler at home.com> wrote in message
news:DfKU6.130092$I5.33794657 at news1.rdc1.tn.home.com...
> OK...I went back to the beginning and discovered that the author of the
> tutorial showed me three windows.
> One with a black background that he described as the Python prompt (>>>)
> (title is Python)
> One with a white background that he described as IDLE - also with a Python
> prompt (title is Python Shell)
> One with a black background that he described as the "command" window that
> in fact is the DOS window (title MS DOS Prompt)
>
> I went to the MS DOS Prompt ("Command") and typed in python alook.py and
got
> an error message:  Bad command or file name.
>
>
> "Glen Mettler" <Glen.Mettler at home.com> wrote in message
> news:TiyU6.127784$I5.32725119 at news1.rdc1.tn.home.com...

This means that Python is not in your path - in other words, Windows can't
find out where the program is located. The advice you've gotten up to now is
pretty good, but I don't recommend changing Autoexec.bat unless you know
what you're doing. It's too easy to drop a semicolon and screw up your
system
to where it won't boot. In addition, I'm told that Autoexec.bat is ignored
on
Windows ME (I'm not certain about that, I've never upgraded.)

What I'm doing looks a bit more complicated, but it works (something that
 is always recommended.)

1. Copy an MS-Dos icon into the directory with your test programs.
2. Create a new .txt file there.
3. Put one line in it:
path=%path%;c:\python21\bin
  spelled exactly like that, no spaces. If your Python21 directory is
somewhere
else, you'll have to change it.
4. change the file type from .txt to .bat
5. Right-click on the Dos icon and select Properties. Make certain it does
not
specify "close on exit." Also make certain that the working directory box
specifies the directory with your Python program.
6. When you want to run a command line, double click on this command icon.
It should show you the directory you're working in.
7. type <command>.bat (whatever you named your command file.) That
should show you the new path. Even if you make a mistake, it won't affect
anything else. The change is completely local to the dos box.
8. type python alook.py

That should get you into your program properly.

I grant you, this looks messy, and I wish there was an easier way, but this
works.

John Roth





More information about the Python-list mailing list