import path, script path (was Re: module path)

David Brady daves_spam_dodging_account at yahoo.com
Fri Dec 28 23:42:16 CET 2001


> From: John Machin [mailto:sjmachin at lexicon.net]
> 
> 2. Can somebody please help with the OP's implicit
> but not quite asked
> 2nd part of question: How to set up the path to
> follow when
> 
> prompt> python myscript.py

I am running Win9x, Win2k, and WinXP, and have
JPSoft's excellent 4Dos and 4NT products for them.  In
them, if you can make python scripts executable by
typing

set .py=c:\Python21\Python.exe
set .pyw=c:\Python21\Python.exe

Or whatever your Python path is, or by adding them to
the environment variables.  Then, if your script file
is anywhere in the executable path (set
PATH=%PATH%;c:\Python21\scripts\), 4Dos or 4NT will go
find Python and run it for you.

I have been told that the standard Windows cmd shell
will do it for you as well, but I don't know how or
where.

Perl has a handy command-line option, -S, which tells
perl to search the PATH for the script if it cannot
find it in the local folder.  I suppose it would be
possible to write a batch file that would run a Python
script to search the cwd and the search path for a
script file, and upon finding it, run Python on that
script there.  Phew... convoluted, but it could
probably be made to work.

Good luck,

-dB

=====
David Brady
daves_spam_dodging_account at yahoo.com
I'm feeling very surreal today... or *AM* I?

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com




More information about the Python-list mailing list