matplotlib/matplotlib — Issue #557: Crash during date axis setup
Author: elpres
Created: 2011-10-27 11:30:22+00:00
State: open

I'm using 1.1.0 on Arch Linux with Python 2.7.2, and while plotting some charts with dates on the x axis, i get this crash:

Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 82, in paintEvent
FigureCanvasAgg.draw(self)
File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 401, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 884, in draw
func(*args)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 1983, in draw
a.draw(renderer)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/axis.py", line 1036, in draw
ticks_to_draw = self._update_ticks(renderer)
File "/usr/lib/python2.7/site-packages/matplotlib/axis.py", line 926, in _update_ticks
tick_tups = [ t for t in self.iter_ticks()]
File "/usr/lib/python2.7/site-packages/matplotlib/axis.py", line 876, in iter_ticks
majorLabels = [self.major.formatter(val, i) for i, val in enumerate(majorLocs)]
File "/usr/lib/python2.7/site-packages/matplotlib/dates.py", line 492, in __call__
return self._formatter(x, pos)
File "/usr/lib/python2.7/site-packages/matplotlib/dates.py", line 342, in __call__
return self.strftime(dt, self.fmt)
File "/usr/lib/python2.7/site-packages/matplotlib/dates.py", line 368, in strftime
return cbook.unicode_safe(dt.strftime(fmt))
File "/usr/lib/python2.7/site-packages/matplotlib/cbook.py", line 40, in unicode_safe
if preferredencoding is None: return unicode(s)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

The same error and traceback are reported twice when the crash happens. There is no crash with a different input dataset, and the date range in this one doesn't have any invalid values, as far as i can see.

Here's how to reproduce it:

1. Download the pickled data from here: http://minus.com/dIRkA1G652ySp.pickle
2. Start ipython --pylab (the problem also happens when the script is executed by plain Python from command line).
3. import pickle
4. x, y, ci_y = pickle.load(open('dump.pickle'))
5. errorbar(x, y, ci_y)