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

defn noob circularfunc at
Sun Jun 29 13:34:37 CEST 2008

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')
#im = file = 'C:/users/me/desktop/images/blob4.jpg'
pic = w.create_image(0, 0, image = im, anchor = NW)

#image = open('C:/users/saftarn/desktop/images/blob.png')

colors = []
for x in range(1, 800):
    for y in range(1, 600):
        pic = w.find_closest(x, y)[0]
        obj = objects[pic]
        colors.append(obj.get(int(x), int(y)))

print colors


Traceback (most recent call last):
  File "C:/Python25/Progs/ImageVideoSearch/", line 9, in
    im = PhotoImage(file = 'C:/users/me/desktop/images/blob4.jpg')
  File "C:\Python25\lib\lib-tk\", line 3270, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Python25\lib\lib-tk\", line 3226, in __init__'image', 'create', imgtype, name,) + options)
TclError: couldn't recognize data in image file "C:/users/me/desktop/

it has worked before opening and displaying a file like this, anything
to do with python 2.52, upgraded from 2.5.1

More information about the Python-list mailing list