Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'debug': 0.03; 'python': 0.08; 'messing': 0.09; 'runtime': 0.09; 'essentially': 0.10; 'library': 0.15; 'arbitrary.': 0.16; 'received:mindspring.com': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; 'looked': 0.16; 'wrote:': 0.16; 'continuing': 0.17; 'yet.': 0.18; 'defined': 0.19; "haven't": 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'pm,': 0.24; 'testing': 0.24; 'aug': 0.24; 'library.': 0.24; 'statement': 0.25; "i'm": 0.27; 'work.': 0.27; '(this': 0.28; 'effect': 0.28; 'import': 0.28; '27,': 0.29; 'subject: .': 0.29; 'script': 0.29; 'seem': 0.31; 'version': 0.32; 'received:24': 0.32; 'topic': 0.32; 'sort': 0.33; 'it.': 0.33; 'probably': 0.33; 'there': 0.33; 'to:addr:python-list': 0.33; "i've": 0.34; 'file.': 0.34; 'charset:us-ascii': 0.36; 'file': 0.36; 'another': 0.37; 'note,': 0.37; 'statements': 0.37; 'but': 0.37; 'two': 0.37; 'could': 0.38; 'some': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'setup': 0.40; 'where': 0.40; 'your': 0.61; 'hope': 0.61; 'double': 0.61; 'header:Message-Id:1': 0.61; '12:56': 0.84; 'examining': 0.84; 'post)': 0.84; 'received:69.73': 0.84; 'redirect': 0.91; 'choose.': 0.93 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Understanding .pth in site-packages From: Philip Semanchuk In-Reply-To: <31bef8dc-d804-454d-85c7-8de1663052a8@glegroupsg2000goo.googlegroups.com> Date: Sat, 27 Aug 2011 13:18:38 -0400 Content-Transfer-Encoding: quoted-printable References: <31bef8dc-d804-454d-85c7-8de1663052a8@glegroupsg2000goo.googlegroups.com> To: python-list list X-Mailer: Apple Mail (2.1084) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - deimos.nocdirect.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - semanchuk.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314465528 news.xs4all.nl 2477 [2001:888:2000:d::a6]:46216 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12276 On Aug 27, 2011, at 12:56 PM, Josh English wrote: > (This may be a shortened double post) >=20 > I have a development version of a library in c:\dev\XmlDB\xmldb >=20 > After testing the setup script I also have = c:\python27\lib\site-packages\xmldb >=20 > Now I'm continuing to develop it and simultaneously building an = application with it. >=20 > I thought I could plug into my site-packages directory a file called = xmldb.pth with: >=20 > c:\dev\XmlDB\xmldb >=20 > which should redirect import statements to the development version of = the library. >=20 > This doesn't seem to work. xmldb.pth should contain the directory that contains xmldb: c:\dev\XmlDB Examining sys.path at runtime probably would have helped you to debug = the effect of your .pth file. On another note, I don't know if the behavior of 'import xmldb' is = defined when xmldb is present both as a directory in site-pacakges and = also as a .pth file. You're essentially giving Python two choices from = where to import xmldb, and I don't know which Python will choose. It may = be arbitrary. I've looked for some sort of statement on this topic in = the documentation, but haven't come across it yet.=20 > Is there a better way to redirect import statements without messing = with the system path or the PYTHONPATH variable? Personally I have never used PYTHONPATH. Hope this helps Philip