[Tutor] Getting Started; Syntax Error; Bad Command or File Name

Kirby Urner urnerk@qwest.net
Wed, 28 Nov 2001 10:07:40 -0800


>
>Andrei,
>First of all, I hope I am doing this correctly(by responding in this manner).
>This is what I did:
>1) Start>Programs>MSDOS prompt
>2) in the MSDOS box I cd\ to where the hello1.py is located
>3) typed:  python hello1.py
>
>4) response was: BAD COMMAND or FILE NAME
>
>Any suggestions?

Frank --

Easiest to put a path to Python in your AUTOEXEC.BAT and
reboot.

Another option is to write a batch file named PYTHON.BAT in
your subdirectory containing .py files that reads:

    c:\python\python %1 %2
    ^^^^^^^^^^^^^^^^
     whatever is the real path to Python

then go >>> python hello1.py [optional parameter]

In any case, what's happening is your python.exe is in
one directory, and your hello1.py is in another, and
there's no "glue" in your setup to find them.

You can also just go:

    >>> c:\python\python hello1.py

using the real path.  This is only tricky if your real
path contains spaces, e.g. my Python is in
D:\program files\python22\ -- so I have to use quotes.
We hope you didn't get so fancy.

As a final remark, if you're really just starting Python,
and want to learn it well, then my advice is you postpone
the Tk stuff for another time.  Tk is a separate language,
to which Python interfaces by means of the Tkinter module.
It's neither the only graphical widgets toolkit Python
can use, nor necessarily the optimum, but in either case,
you're making the learning curve twice as steep by trying
to grapple with Tk and Python at the same time.

In pure Python, helloworld.py is just:

    print "Hello World"

... quick and easy.

Kirby