Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12345

Re: Understanding .pth files

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'package,': 0.03; 'python': 0.08; 'dev': 0.09; 'subject:files': 0.09; 'to:addr:comp.lang.python': 0.09; 'am,': 0.12; 'package.': 0.12; 'library': 0.15; '"import': 0.16; 'docs,': 0.16; 'slashes': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; "doesn't": 0.22; 'cc:2**0': 0.22; 'header:In- Reply-To:1': 0.22; 'aug': 0.24; 'preferred': 0.25; 'tried': 0.26; 'modify': 0.28; 'sat,': 0.28; 'import': 0.28; '27,': 0.29; 'subject: .': 0.29; 'message-id:@mail.gmail.com': 0.29; 'environment': 0.29; 'cc:addr:python.org': 0.30; 'folder.': 0.30; 'line:': 0.30; 'seem': 0.31; 'received:209.85.161.46': 0.31; 'received:mail-fx0-f46.google.com': 0.31; 'version': 0.32; 'pointing': 0.32; 'actual': 0.32; 'installed': 0.32; 'it.': 0.33; 'all.': 0.34; 'packages,': 0.34; 'uses': 0.35; 'folder': 0.35; 'received:209.85.161': 0.35; 'file': 0.36; 'skip:" 10': 0.36; 'put': 0.37; 'but': 0.37; 'too,': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'itself.': 0.39; 'else': 0.39; 'called': 0.40; "i'd": 0.40; 'delete': 0.40; 'might': 0.40; 'your': 0.61; 'according': 0.62; 'here': 0.65; 'direct': 0.66; 'care': 0.71; "(i've": 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=HoeOLQWvWd3u3sYH7+gmyvbiWZBduLRzXsxoF1GWu1s=; b=q3h+dsi42x/iHnX5Yj4scPbK8Rt1h3Ak9Z6AvNoL6eOAGzlGJwYht3b3dO3H/uizXD YbIo12HX3FvyzUm33lq880mbezks5pp2ERwYYMK4Kts1Zv+J+S/bJ0Va3uNIFAbAG9qd 5jIBKk2SXU4EpKPexII+p/ZJDODXcgJLYnB9w=
MIME-Version 1.0
In-Reply-To <5cc361da-b1e3-47eb-b4e2-b6d92b350fb2@glegroupsg2000goo.googlegroups.com>
References <5cc361da-b1e3-47eb-b4e2-b6d92b350fb2@glegroupsg2000goo.googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 28 Aug 2011 10:32:23 -0600
Subject Re: Understanding .pth files
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.508.1314549176.27778.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314549176 news.xs4all.nl 2494 [2001:888:2000:d::a6]:39939
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12345

Show key headers only | View raw


On Sat, Aug 27, 2011 at 10:42 AM, Josh English
<Joshua.R.English@gmail.com> wrote:
> According to the docs, I should be able to put a file in the site-packages directory called xmldb.pth pointing anywhere else on my drive to include the package. I'd like to use this to direct Python to include the version in the dev folder and not the site-packages folder.

The name of the .pth file is not important.  Python uses it to add
locations to sys.path; it doesn't care what packages might be
contained at those locations.

> So my C:\Python27\lib\site-packages\xmldb.pth file has one line:
>
> c:\dev\XmlDB\xmldb

The final xmldb is the actual package, yes?  The directory in the .pth
file should be one inside which Python can find packages, not a
package itself.  So the file should have just "c:\dev\XmlDB".  Then
when you do "import xmldb", Python will look inside the
"c:\dev\XmlDB", find the xmldb package, and import it.

>
> (I've tried the slashes the other way, too, but it doesn't seem to work).
>
> Is the only solution to delete the installed library and add the dev folder to my site.py file?

The preferred solution here is to use virtualenv to set up your
development environment without having to modify the installed version
in the system site-packages at all.

HTH,
Ian

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Understanding .pth files Josh English <Joshua.R.English@gmail.com> - 2011-08-27 09:42 -0700
  Re: Understanding .pth files Ian Kelly <ian.g.kelly@gmail.com> - 2011-08-28 10:32 -0600

csiph-web