Understanding .pth in site-packages

Philip Semanchuk philip at semanchuk.com
Sat Aug 27 16:28:27 EDT 2011

On Aug 27, 2011, at 4:14 PM, Terry Reedy wrote:

> On 8/27/2011 2:07 PM, Philip Semanchuk wrote:
>> On Aug 27, 2011, at 1:57 PM, Josh English wrote:
>>> Philip,
>>> Yes, the proper path should be c:\dev\XmlDB, which has the
>>> setup.py, xmldb subfolder, the docs subfolder, and example
>>> subfolder, and the other text files proscribed by the package
>>> development folder.
>>> I could only get it to work, though, by renaming the xmldb folder
>>> in the site-packages directory, and deleting the egg file created
>>> in the site-packages directory.
>>> Why the egg file, which doesn't list any paths, would interfere I
>>> do not know.
>>> But with those changes, the xmldb.pth file is being read.
>>> So I think the preferred search order is:
>>> 1. a folder in the site-packages directory 2. an Egg file (still
>>> unsure why) 3. A .pth file
>> That might be implementation-dependent or it might even come down to
>> something as simple as the in which order the operating system
>> returns files/directories when asked for a listing.
> Doc says first match, and I presume that includes first match within a directory.

First match using which ordering? Do the docs clarify that?


More information about the Python-list mailing list