[Image-SIG] import ICCProfile Error

Fredrik Lundh fredrik at pythonware.com
Sun Nov 14 04:44:18 CET 2010


So after digging a bit further, the suspect is the auto-reload
mechanisms in GAE's development appserver -- the appserver attempts to
clear out all imported modules in sys.modules when it detects changes
to your application code, and that process apparently leaves the PIL
modules in a half-baked state (i.e. "PIL" has been removed, but code
for "PIL.PngImagePlugin" is still around).

You're not importing PIL code directly, are you?

</F>

On Sat, Nov 13, 2010 at 3:17 PM, Fredrik Lundh <fredrik at pythonware.com> wrote:
> By the way, I'm pretty sure that this only happens for some PNG
> images, and once you upload your application, PNG reading is done by
> GAE:s image library, not PIL, so the application you're building
> should be fine.
>
> </F>
>
> On Sat, Nov 13, 2010 at 2:40 PM, Fredrik Lundh <fredrik at pythonware.com> wrote:
>> On Fri, Nov 12, 2010 at 10:33 PM, Bharathwaaj Srinivasan
>> <bharathwaaj.s at gmail.com> wrote:
>>> I'm trying to get the images-demo working for google appengine.
>>>
>>> http://code.google.com/p/google-app-engine-samples/source/browse/trunk/images-demo
>>>
>>> The full traceback can be found here:
>>>
>>> http://pastebin.com/cBn6cA0V
>>
>> Hmm. First time I've ever seen that error in any context.  Looks like
>> GAE's import mechanisms cause some trouble for relative imports that
>> won't happen if you run things stand-alone.  And it looks like PIL's
>> far from the only library suffering from this:
>>
>> http://www.google.com/search?q=%22SystemError:+Parent+module+*+not+loaded%22
>>
>> even if most PIL reports I found seem to be for GAE.  My guess is that
>> it's some misfeature in the changes to relative import that was
>> introduced in 2.6 (iirc), but since it doesn't happen when you run PIL
>> in a normal configuration, I'm not sure how to debug it.  If someone
>> can come up with a simple test case that triggers this, let me know.
>>
>> I guess this also means that adding an ICCProfile module to the path
>> won't help you; if you cannot figure out something better, you might
>> have to comment out the problematic code (or you could try replacing
>> the relative import with a "from PIL import" and see if that helps).
>>
>> </F>
>>
>>> On 13 November 2010 02:04, Fredrik Lundh <fredrik at pythonware.com> wrote:
>>>>
>>>> On Fri, Nov 12, 2010 at 7:30 PM, Bharathwaaj Srinivasan
>>>> <bharathwaaj.s at gmail.com> wrote:
>>>> > I keep getting error in import ICCProfile in PNGImagePlugin.py _save.
>>>> >
>>>> > What am I missing? Which package contains ICCProfile?
>>>>
>>>> Not sure why that code was left in there, but iirc it's an extension hook.
>>>>
>>>> > I've been searching but couldn't get a clue on why it is failing.
>>>>
>>>> Me neither, given that the import is protected by a try/except.
>>>>
>>>>   try:
>>>>       import ICCProfile
>>>>   except ImportError:
>>>>       ...
>>>>
>>>> What exactly are you doing when you get this import error, and what
>>>> does the full traceback look like?
>>>>
>>>> </F>
>>>
>>>
>>
>


More information about the Image-SIG mailing list