This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients docs@python, gpolo, martin.panter, serhiy.storchaka
Date 2014-05-28.22:30:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks for looking at this. Originally the issue was found by reading the GIF and PNG images on various web pages, such as <>. However I was also able to produce the problem with the other formats of that Python logo:

$ python3 -Wall -bt
Python 3.4.1 (default, May 19 2014, 17:40:19) 
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter; tk = tkinter.Tk(); text = tkinter.Text(tk); text.pack()
>>> with open("/lib/python3.4/test/imghdrdata/python.png", "rb") as file: data =
>>> image = tkinter.PhotoImage(format="png", data=data)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/tkinter/", line 3384, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/usr/lib/python3.4/tkinter/", line 3340, in __init__'image', 'create', imgtype, name,) + options)
_tkinter.TclError: CRC check failed
>>> u8png = tkinter.PhotoImage(format="png", data=data.decode("latin-1").encode("utf-8"))
>>> text.image_create(tkinter.END, image=u8png)

The same problem occurs with the PGM and PPM logos, and the Base-64 encoding trick does not work with those; only UTF-8 encoding. However as you discovered, the GIF format logo works no problem when passed unencoded, although it continues to work if I use my UTF-8 encoding trick, which is a bit strange. Perhaps the internal UTF-8 decoding step is passing the invalid UTF-8 straight through?
Date User Action Args
2014-05-28 22:30:35martin.pantersetrecipients: + martin.panter, gpolo, docs@python, serhiy.storchaka
2014-05-28 22:30:35martin.pantersetmessageid: <>
2014-05-28 22:30:35martin.panterlinkissue21580 messages
2014-05-28 22:30:34martin.pantercreate