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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sat, Aug 27, 2011 at 10:42 AM, Josh English wrote: > According to the docs, I should be able to put a file in the site-package= s 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 i= n 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 fold= er 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