tkinter, loading image error, TclError: couldn't recognize data in image file "C:/users/me/desktop/images/blob4.jpg"

Eric Brunel see.signature at no.spam
Mon Jun 30 11:26:27 CEST 2008


On Sun, 29 Jun 2008 13:34:37 +0200, defn noob <circularfunc at yahoo.se>  
wrote:

> from Tkinter import *
> import os
>
> master = Tk()
> w = Canvas(master, width=800, height=600)
>
> print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg')
>
> im = PhotoImage(file = 'C:/users/saftarn/desktop/images/blob4.jpg')
[snip]
>>>>
> True
>
> Traceback (most recent call last):
>   File "C:/Python25/Progs/ImageVideoSearch/imId.py", line 9, in
> <module>
>     im = PhotoImage(file = 'C:/users/me/desktop/images/blob4.jpg')
>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 3270, in __init__
>     Image.__init__(self, 'photo', name, cnf, master, **kw)
>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 3226, in __init__
>     self.tk.call(('image', 'create', imgtype, name,) + options)
> TclError: couldn't recognize data in image file "C:/users/me/desktop/
> images/blob4.jpg"
>>>>
>
>
>
> it has worked before opening and displaying a file like this, anything
> to do with python 2.52, upgraded from 2.5.1

Did it? Because AFAIK, tcl/tk has never natively recognized any other  
image format than PPM/PGM and GIF... No JPG, no PNG...
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list