Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-18 Thread Cem Karan
On Feb 16, 2017, at 9:55 PM, Rustom Mody wrote: > On Friday, February 17, 2017 at 3:24:32 AM UTC+5:30, Terry Reedy wrote: >> On 2/15/2017 7:42 AM, poseidon wrote: >> >>> what are pth files for? >> >> They are for extending (mainly) lib/site-packages. > > > Hey Terry! > This needs to get in

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-16 Thread Rustom Mody
On Friday, February 17, 2017 at 3:24:32 AM UTC+5:30, Terry Reedy wrote: > On 2/15/2017 7:42 AM, poseidon wrote: > > > what are pth files for? > > They are for extending (mainly) lib/site-packages. Hey Terry! This needs to get into more public docs than a one-off post on a newsgroup/ML -- htt

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-16 Thread Terry Reedy
On 2/15/2017 7:42 AM, poseidon wrote: what are pth files for? They are for extending (mainly) lib/site-packages. To repeat what I have posted before: every time I install a new version of Python, I add (copy) python.pth containing 'F:/python' (without the quotes). This makes my directory

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Ned Batchelder
On Wednesday, February 15, 2017 at 8:34:45 AM UTC-5, Wolfgang Maier wrote: > On 15.02.2017 13:42, poseidon wrote: > > On 15/02/17 12:16, Wolfgang Maier wrote: > >> On 15.02.2017 10:33, poseidon wrote: > >>> In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains > >>> the line > >>

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread gst
Le mercredi 15 février 2017 10:34:42 UTC-5, Steve D'Aprano a écrit : > On Wed, 15 Feb 2017 11:42 pm, poseidon wrote: > > > Yes, removed it (symlink still there) and it still works. But then, what > > are pth files for? > > > Good question. I don't actually know anyone that uses pth files, so pe

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Steve D'Aprano
On Wed, 15 Feb 2017 11:42 pm, poseidon wrote: > Yes, removed it (symlink still there) and it still works. But then, what > are pth files for? Good question. I don't actually know anyone that uses pth files, so perhaps they're unnecessary. But the principle behind them is that they can be used

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread poseidon
On 15/02/17 14:34, Wolfgang Maier wrote: On 15.02.2017 13:42, poseidon wrote: On 15/02/17 12:16, Wolfgang Maier wrote: On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 13:42, poseidon wrote: On 15/02/17 12:16, Wolfgang Maier wrote: On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file,

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread poseidon
On 15/02/17 12:16, Wolfgang Maier wrote: On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file, so it should be possible to write imp

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file, so it should be possible to write import tau4 in my programs. No, that's no

Re: .pth files and figuring out valid paths..

2009-06-11 Thread Gabriel Genellina
En Tue, 09 Jun 2009 20:30:06 -0300, rh0dium escribió: On Jun 9, 3:28 pm, Emile van Sebille wrote: On 6/9/2009 3:00 PM rh0dium said... > I have a .pth file which has some logic in it - but it isn't quite > enough... > It started with this.. > import os, site; site.addsitedir(os.path.join(os.e

Re: .pth files and figuring out valid paths..

2009-06-09 Thread David Lyon
On Tue, 9 Jun 2009 21:33:56 -0700 (PDT), rh0dium wrote: >> Having multiple paths or multiple .PTH files isn't a >> problem for python. > .. > We use it for our dev tree before we roll to production. Once dev is > QA'd then we (integrate) those changes to main and release. Makes sense... :-)

Re: .pth files and figuring out valid paths..

2009-06-09 Thread rh0dium
On Jun 9, 4:58 pm, David Lyon wrote: > On Tue, 9 Jun 2009 16:30:06 -0700 (PDT), rh0dium > wrote: > > >> > Apparently there is a problem with the if statement??? > > >> > Thanks > > > No for .pth files this needs to be on a single line.. > > I can't really see why you need conditional code... > >

Re: .pth files and figuring out valid paths..

2009-06-09 Thread rh0dium
On Jun 9, 9:19 pm, alex23 wrote: > On Jun 10, 8:00 am, rh0dium wrote: > > > Apparently there is a problem with the if statement??? > > Try restructuring the if as a ternary condition: > > import os, site; smsc = os.environ.get("TECHROOT", "/home/tech"); smsc > = smsc if os.path.isdir(smsc) else "

Re: .pth files and figuring out valid paths..

2009-06-09 Thread alex23
On Jun 10, 8:00 am, rh0dium wrote: > Apparently there is a problem with the if statement??? Try restructuring the if as a ternary condition: import os, site; smsc = os.environ.get("TECHROOT", "/home/tech"); smsc = smsc if os.path.isdir(smsc) else "/home/tech"; site.addsitedir (os.path.join(smsc,

Re: .pth files and figuring out valid paths..

2009-06-09 Thread David Lyon
On Tue, 9 Jun 2009 16:30:06 -0700 (PDT), rh0dium wrote: >> > Apparently there is a problem with the if statement??? >> >> > Thanks > > No for .pth files this needs to be on a single line.. I can't really see why you need conditional code... If you want to add more locations... Simply create a

Re: .pth files and figuring out valid paths..

2009-06-09 Thread rh0dium
On Jun 9, 3:28 pm, Emile van Sebille wrote: > On 6/9/2009 3:00 PM rh0dium said... > > > > > > > I have a .pth file which has some logic in it - but it isn't quite > > enough... > > > It started with this.. > > import os, site; site.addsitedir(os.path.join(os.environ["TECHROOT"], > > "tools/python/

Re: .pth files and figuring out valid paths..

2009-06-09 Thread Emile van Sebille
On 6/9/2009 3:00 PM rh0dium said... I have a .pth file which has some logic in it - but it isn't quite enough... It started with this.. import os, site; site.addsitedir(os.path.join(os.environ["TECHROOT"], "tools/python/modules")) But that eventually evolved into.. import os, site; site.addsite

Re: .pth files question

2005-09-02 Thread Peter Hansen
Benjamin Rutt wrote: > Am I correct in understanding that: > > 1) foo.pth will be used if it is in the directory > /usr/lib/python-2.4/site-packages > > 2) foo.pth will not be read from if it is only placed somewhere in the > PYTHONPATH environment, such as foo.pth exists as the file > /tmp/bar/f

Re: .pth files question

2005-09-02 Thread Michael Hoffman
Benjamin Rutt wrote: > Am I correct in understanding that: > > 1) foo.pth will be used if it is in the directory > /usr/lib/python-2.4/site-packages > > 2) foo.pth will not be read from if it is only placed somewhere in the > PYTHONPATH environment, such as foo.pth exists as the file > /tmp/bar/f

Re: .pth files in working directory

2005-08-31 Thread Peter Maas
Peter Hansen schrieb: > Peter Maas wrote: >> But sitecustomize.py changes the Python installation, doesn't it? >> This wouldn't be an advantage over putting a .pth file into >> .../site-packages. > > > You can have a local sitecustomize.py in the current directory, which > wouldn't change the Py

Re: .pth files in working directory

2005-08-31 Thread Peter Maas
Michael Ekstrand schrieb: > 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 IIS sets the the site path as working directory. So I would probably have to chang

Re: .pth files in working directory

2005-08-31 Thread Peter Hansen
Peter Maas wrote: > Peter Hansen schrieb: >> generally such non-standard sys.path and .pth manipulations are best >> handled by a sitecustomize.py file, possibly which makes its own calls >> to site.addsitedir() and such. Try "help(site)" for more. > > But sitecustomize.py changes the Python in

Re: .pth files in working directory

2005-08-31 Thread Michael Ekstrand
On Wed, 31 Aug 2005 15:07:41 +0200 Peter Maas <[EMAIL PROTECTED]> 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 to

Re: .pth files in working directory

2005-08-31 Thread Peter Maas
Peter Hansen schrieb: > Not sure from the above description exactly what it is you want, 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. T

Re: .pth files in working directory

2005-08-31 Thread Peter Hansen
Peter Maas wrote: > My goal is to have the top level of a directory tree in the Python > path without touching anything outside the directory. I tried to > create .pth files with the top level path in every subdirectory > but this doesn't work despite working directory being part of the > Python pa

Re: .pth files

2005-08-09 Thread Peter Hansen
Neil Benn wrote: >* Site.py is prompted to load a sitecustomise.py file which is > located in the Lib directory - if it is there. This file is > automatically executed on the start up of python. Here you can > look for a command line argument (or a local config file) passed >

Re: .pth files

2005-08-09 Thread Neil Benn
Sylvain Thenault wrote: >On Tue, 09 Aug 2005 09:37:47 +, Adriano Varoli Piazza wrote: > > > >>Sylvain Thenault ha scritto: >> >> >>>Hi there ! >>> >>>I've some questions regarding pth files (which btw are undocumented in >>>the python reference, is this intentional ?) >>> >>>I thought th

Re: .pth files

2005-08-09 Thread Erik Max Francis
Richie Hindle wrote: > http://google.com/search?q=site:docs.python.org%20pth > > The first hit explains how .pth files work (although it's the sort of > documentation that makes Xah Lee explode with fury). That just makes it all the more delicious. -- Erik Max Francis && [EMAIL PROTECTED] && h

Re: .pth files

2005-08-09 Thread Richie Hindle
[Sylvain] > I've some questions regarding pth files (which btw are undocumented in the > python reference, is this intentional ?) http://google.com/search?q=site:docs.python.org%20pth The first hit explains how .pth files work (although it's the sort of documentation that makes Xah Lee explode w

Re: .pth files

2005-08-09 Thread Sylvain Thenault
On Tue, 09 Aug 2005 09:37:47 +, Adriano Varoli Piazza wrote: > Sylvain Thenault ha scritto: >> Hi there ! >> >> I've some questions regarding pth files (which btw are undocumented in >> the python reference, is this intentional ?) >> >> I thought that I could use a .pth file to be able to im

Re: .pth files

2005-08-09 Thread Adriano Varoli Piazza
Sylvain Thenault ha scritto: > Hi there ! > > I've some questions regarding pth files (which btw are undocumented in the > python reference, is this intentional ?) > > I thought that I could use a .pth file to be able to import zope products > from both INSTANCE_HOME/Products and ZOPE_HOME/lib/py

Re: .pth files?

2005-03-23 Thread Skip Montanaro
>> I have a mojam.pth file but no "mojam" package on my server. Works >> just fine. Ben> Where does it call home? site-packages? Yup. -- http://mail.python.org/mailman/listinfo/python-list

Re: .pth files?

2005-03-22 Thread Bengt Richter
On 22 Mar 2005 09:29:39 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >I'm unclear on how .pth files work. Some posts imply they can be >arbitrarily named, as long as they include the .pth extension, and can >exist anywhere in the current sys.path. Other documentation seems to >imply tha

Re: .pth files?

2005-03-22 Thread Peter Hansen
[EMAIL PROTECTED] wrote: I'm unclear on how .pth files work. Some posts imply they can be arbitrarily named, as long as they include the .pth extension, and can exist anywhere in the current sys.path. Other documentation seems to imply that they must be named .pth, although I'm not sure what "pac

Re: .pth files?

2005-03-22 Thread Ben Beuchler
On Tue, 22 Mar 2005 12:52:28 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote: > .pth naming is just a convention so you can easily sort out the > association for each of multiple pth files. I have a mojam.pth file but no > "mojam" package on my server. Works just fine. Interesting. Where does

Re: .pth files?

2005-03-22 Thread Skip Montanaro
Ben> I'm unclear on how .pth files work. Some posts imply they can be Ben> arbitrarily named, as long as they include the .pth extension, and Ben> can exist anywhere in the current sys.path. Other documentation Ben> seems to imply that they must be named .pth, although I'm Be