[Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ??

Sebastian Haase haase at msg.ucsf.edu
Mon Apr 14 23:30:03 CEST 2008


On Mon, Apr 14, 2008 at 11:07 PM, Steve Holden <steve at holdenweb.com> wrote:
>
> Sebastian Haase wrote:
>
> > On Mon, Apr 14, 2008 at 9:26 PM, Nicolas Pinault
> > <nicolas at famillepinault.fr> wrote:
> >
> > >
> > >
> > > > Hi,
> > > >
> > > > this is a short question:
> > > >
> > > > Why does Image.open fail after reload(Image) ?
> > > >
> > > >
> > > >
> > >  Why do you need to reload Image package ?
> > >
> > >  Nicolas
> > >
> >
> > I have a "reloadAll" function -- and then it's always quite annoying
> > if I have to "reboot" Python ;-)
> > Also I think the when I want to add new things to PIL itself, a reload
> > would be very convenient !!
> >
> >
>  Indeed it would, but unless I am out of date there is no mechanism to
> reload extension (compiled) modules, so _imaging would have to stay there
> once loaded.
>
Yes, of course. But there is *a lot* of Python code that might be
worth reloading.

And in any case even IF you were to do a reload(_imaging)  (without
the intended result, of course) it would not cause _imaging to fail
from then on.

But again, all I'm asking for is that PIL should not fail after a
reload.  In fact, I just found that, e.g. reload(TiffImagePlugin)
works. It's just that a reload(Image) is fatal.

I think that Image.py contains some "not so clean magic", that might
be worth thinking about. I'm talking about changing sys.path (and
undoing that change afterwards)

-Sebastian


More information about the Image-SIG mailing list