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

John Machin sjmachin at lexicon.net
Fri Dec 28 16:18:25 EST 2001


"Alex Martelli" <aleax at aleax.it> wrote in message news:<a0hn1l$lbd$1 at serv1.iunet.it>...
> "Garett Shulman" <shulmang at colorado.edu> wrote in message
> news:n1an2u4rvau9f86r5dcl895lokb05354pr at 4ax.com...
> > I would like to store my modules and scripts in a folder other than
> > the python folder. Does anyone have any suggestions as to what I need
> > to do in order to be able to import the scipts in the interpreter? Is
> > there a path that the interpreter searches which I could modify?
> 

[snipped: Alex's answer re first part of the OP's question -- path to
follow when
        import mymodule
]

1. I note that (for win32) since Python 2.2, <python
directory>\lib\site-packages appears as the last entry of sys.path
(and this is the default location where distutils unloads the truck
when you say >python setup.py install).

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

The answers are no doubt OS-specific; help for the Windows NT family
would be personally appreciated.

For example, having to do this is a pain:
prompt>python %pythonbin%\Tools\Scripts\ndiff.py

Cheers & TIA,
John



More information about the Python-list mailing list