Re: import ICCProfile Error

Florian Höch <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Hi,

the whole part

try:
     import ICCProfile
     ...
except ImportError:

is a leftover from development code. It can be removed with just leaving the

name = "ICC Profile"

without impeding any functionality (I contributed support for ICC 
profile reading/writing a while back, and forgot to remove that part 
back then). Sorry for the confusion caused.

Am 14.11.2010 20:06, schrieb Fredrik Lundh:
> I suspect a buglet in the GAE development server: when reloading the
> code, it explicitly messes with sys.modules in a way that triggers
> this error when PIL is invoked the next time (by calling code in a
> module that no longer exists in sys.modules).  It only happens for
> some PNG files, and only for PIL 1.1.7, so it hasn't shown up in their
> tests yet.  And it doesn't happen in programs that doesn't manipulate
> sys.modules directly (i.e. most programs), so we haven't seen it on
> image-sig before.
>
> </F>
>
> On Sun, Nov 14, 2010 at 6:44 PM, Bharathwaaj Srinivasan
> <[email protected]>  wrote:
>> As you suggested, I've commented out the try except code
>>
>>          #try:
>>          #    import ICCProfile
>>          #    p = ICCProfile.ICCProfile(im.info["icc_profile"])
>>          #    name = p.tags.desc.get("ASCII", p.tags.desc.get("Unicode",
>> p.tags.desc.get("Macintosh", p.tags.desc.get("en", {}).get("US", "ICC
>> Profile")))).encode("latin1", "replace")[:79]
>>          #except ImportError:
>>          name = "ICC Profile"
>>
>> and it works fine. Still couldn't understand why it was failing?
>>
>> Kind regards,
>> Bharath
>>
>> On 14 November 2010 22:26, Fredrik Lundh<[email protected]>  wrote:
>>>
>>> On Sun, Nov 14, 2010 at 3:46 PM, Bharathwaaj Srinivasan
>>> <[email protected]>  wrote:
>>>> Hi,
>>>>
>>>> I tried from the command line. Still getting error. Please see the log.
>>>>
>>>> bharath@bharath-laptop:~/workspace/webKit$ python2.5
>>>> Python 2.5.5 (r255:77872, Nov  3 2010, 13:18:19)
>>>> [GCC 4.4.5] on linux2
>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>>> import PIL
>>>>>>> import ICCProfile
>>>> Traceback (most recent call last):
>>>>    File "<stdin>", line 1, in<module>
>>>> ImportError: No module named ICCProfile
>>>>>>> from PIL import ICCProfile
>>>> Traceback (most recent call last):
>>>>    File "<stdin>", line 1, in<module>
>>>> ImportError: cannot import name ICCProfile
>>>>>>>
>>>
>>> That's irrelevant -- in the PNG module, the import is wrapped inside a
>>> try/except statement.  The problem is that the try/except expects an
>>> ImportError (which you'e seeing), not a SystemError (which is what
>>> happens inside GAE).
>>>
>>> </F>
>>
>>
> _______________________________________________
> Image-SIG maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/image-sig

Regards
-- 
Florian Höch

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.