[Image-SIG] PIL as a package

Fredrik Lundh fredrik@pythonware.com
Wed, 29 Sep 1999 13:49:49 +0200


Georg Mischler <schorsch@schorsch.com> wrote:
> (let's shoot everything at them as long as it's wednesday... ;)

well, we won't guarantee that we'll answer
questions the same day :-)

> I read somewhere that the current PIL release should work
> equally well as plain modules (with PIL.pth) or as a package.
> I may have misunderstood this, but the only problem I found
> should be fairly easy to fix. The preinit() and init() methods
> search for the plug-ins on sys.path. This fails if PIL is
> installed as a package (I was fooled myself first, because I
> still had a non-package installation around on my system...).

Anthony Baxter pointed this out a while ago, and
Fred Drake came up with the following solution:

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

which will be in the forthcoming maintenance
release (PIL 1.0.1).

(and yes, I also had a non-package installation on
my box -- and so did the person contributing the
original package fix, I suppose)

</F>