[IPython-dev] Can't display gifs in notebooks.

Carl Smith carl.input@gmail....
Mon Jul 9 18:17:56 CDT 2012


I'm just testing the Notebook Tour example and gifs don't work.

I run this:

from IPython.display import Image
Image('http://python.org/images/python-logo.gif')

And get this:

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-12-57e6a6c62249> in <module>()
      1 from IPython.display import Image
----> 2 Image('http://python.org/images/python-logo.gif')

/usr/local/lib/python2.7/dist-packages/IPython/core/displayhook.pyc in
__call__(self, result)
    240             self.update_user_ns(result)
    241             self.log_output(format_dict)
--> 242             self.finish_displayhook()
    243
    244     def flush(self):

/usr/local/lib/python2.7/dist-packages/IPython/zmq/displayhook.pyc in
finish_displayhook(self)
     59         sys.stdout.flush()
     60         sys.stderr.flush()
---> 61         self.session.send(self.pub_socket, self.msg, ident=self.topic)
     62         self.msg = None
     63

/usr/local/lib/python2.7/dist-packages/IPython/zmq/session.pyc in
send(self, stream, msg_or_type, content, parent, ident, buffers,
subheader, track, header)
    557
    558         buffers = [] if buffers is None else buffers
--> 559         to_send = self.serialize(msg, ident)
    560         flag = 0
    561         if buffers:

/usr/local/lib/python2.7/dist-packages/IPython/zmq/session.pyc in
serialize(self, msg, ident)
    461             content = self.none
    462         elif isinstance(content, dict):
--> 463             content = self.pack(content)
    464         elif isinstance(content, bytes):
    465             # content is already packed, as in a relayed message

/usr/local/lib/python2.7/dist-packages/IPython/zmq/session.pyc in <lambda>(obj)
     76
     77 # ISO8601-ify datetime objects
---> 78 json_packer = lambda obj: jsonapi.dumps(obj, default=date_default)
     79 json_unpacker = lambda s: extract_dates(jsonapi.loads(s))
     80

/usr/lib/python2.7/dist-packages/zmq/utils/jsonapi.pyc in dumps(o, **kwargs)
     72     """%jsonmod
     73
---> 74     return _squash_unicode(jsonmod.dumps(o,
separators=(',',':'),**kwargs))
     75
     76 def loads(s,**kwargs):

/usr/lib/python2.7/dist-packages/simplejson/__init__.pyc in dumps(obj,
skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent,
separators, encoding, default, use_decimal, namedtuple_as_object,
tuple_as_array, **kw)
    294         namedtuple_as_object=namedtuple_as_object,
    295         tuple_as_array=tuple_as_array,
--> 296         **kw).encode(obj)
    297
    298

/usr/lib/python2.7/dist-packages/simplejson/encoder.pyc in encode(self, o)
    224         # exceptions aren't as detailed.  The list call should
be roughly
    225         # equivalent to the PySequence_Fast that ''.join() would do.
--> 226         chunks = self.iterencode(o, _one_shot=True)
    227         if not isinstance(chunks, (list, tuple)):
    228             chunks = list(chunks)

/usr/lib/python2.7/dist-packages/simplejson/encoder.pyc in
iterencode(self, o, _one_shot)
    294                 self.namedtuple_as_object, self.tuple_as_array)
    295         try:
--> 296             return _iterencode(o, 0)
    297         finally:
    298             key_memo.clear()

UnicodeDecodeError: 'utf8' codec can't decode byte 0xd3 in position 6:
invalid continuation byte

It works fine with pngs and jpgs, just not gifs. I seem to get pretty
much the same error for all gifs.

I really need to get this working. Any help is appreciated.

Thanks

Carl


More information about the IPython-dev mailing list