Re: .pth files in working directory
- From: Michael Ekstrand <mekstran@xxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 08:14:30 -0500
On Wed, 31 Aug 2005 15:07:41 +0200
Peter Maas <peter@xxxxxxxxxxxxx> wrote:
> I want a tree
>
> top/
> install.py
> sub1/
> __init__.py
> mod1.py
> sub2/
> mod2.py
>
> where I can do "from sub1 import mod1" in mod2.py no matter what the
> absolute path of top is. To achieve this I start install.py once to
> retrieve the absolute dir of itself (= abspath of top/) and creates
> .pth files with its absolute dir in every subdirectory.
If top/ is the working directory for your Python interpreter, the
problem is solved automatically. Python puts the current working
directory in the default search path. So, if you run
python sub2/mod2.py
then it would work.
HTH,
-Michael
.
- Follow-Ups:
- Re: .pth files in working directory
- From: Peter Maas
- Re: .pth files in working directory
- References:
- .pth files in working directory
- From: Peter Maas
- Re: .pth files in working directory
- From: Peter Hansen
- Re: .pth files in working directory
- From: Peter Maas
- .pth files in working directory
- Prev by Date: Re: Sockets: code works locally but fails over LAN
- Next by Date: Re: .pth files in working directory
- Previous by thread: Re: .pth files in working directory
- Next by thread: Re: .pth files in working directory
- Index(es):
Relevant Pages
|