[Image-SIG] PIL 1.0 as a package

Fred L. Drake, Jr. Fred L. Drake, Jr." <fdrake@acm.org
Fri, 3 Sep 1999 14:15:14 -0400 (EDT)


Anthony Baxter writes:
 > If you nuke the PIL.pth file (to remove the ImageFile.py clash with Zope)
 > you can no longer autoload ImagePlugin.py files.  I found that as a quick
 > workaround, to change Image.py so that instead of looking in sys.path[n],
 > it instead looks in sys.path[n]+"/PIL" for the files.

  The "right" approach to doing this for packages would be to select
the search path this way:

    import sys
    try:
        path = __path__
    except NameError:
        path = sys.path

path will be set to the "right thing" after this, and will be a lot
faster to search if __path__ is defined (because it'll be shorter; for 
PIL, just one entry!).


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives