REPOST: 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

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!newspeer.monmouth.com!news-xfer.nuri.net!news-hub.kaist.ac.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: sjmachin at lexicon.net (John Machin)
Newsgroups: comp.lang.python
Subject: cmsg cancel <c76ff6fc.0112281318.39a3230 at posting.google.com>
Control: cancel <c76ff6fc.0112281318.39a3230 at posting.google.com>
Date: Mon, 31 Dec 2001 03:25:05 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.c76ff6fc.0112281318.39a3230 at posting.google.com>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775051 27193 211.57.49.2 (31 Dec 2001 05:04:11 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:04:11 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list