[Tutor] Python from WINNT command line question

alan.gauld@bt.com alan.gauld@bt.com
Tue, 28 May 2002 17:27:51 +0100


> Python 2.2 is installed in f:\ptython22, as are my .py 
> program files.  I

> E:\WINNT4>path
> PATH=f:\python22;f:\python22\lib

So this means you don't need the full path when 
calling python itself

> E:\WINNT4>set PYTHONPATH
> PYTHONPATH=f:\python22\lib

And thismeans you can import your files into python 
scripts located elsewhee.

> E:\WINNT4>f:\python22\python foo.py

But foo.py is not visible because its in your python directory...

Try:

E:\WINNT4>python f:\python22\foo.py

instead. This uses the PATYH to call Python. The explicit 
path to tell python where the top level script is and 
foo.py then uses PYTHONPATH to find the files it imports.

Hopefully that makes sense(and works!)

Alan G.