Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash during date axis setup #557

Closed
elpres opened this issue Oct 27, 2011 · 4 comments
Closed

Crash during date axis setup #557

elpres opened this issue Oct 27, 2011 · 4 comments

Comments

@elpres
Copy link
Contributor

elpres commented Oct 27, 2011

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 occurs 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)
@pelson
Copy link
Member

pelson commented Sep 2, 2012

@elpres : Without wanting to cause any offence, I (and I suspect others who do mpl development) greatly appreciate the fact that you have provided the full sample data to reproduce the problem; however I would not be willing to open a pickle file downloaded from the internet (http://nadiana.com/python-pickle-insecure). Is there any way you could boil this down to just a couple of lines of code? Does simply repr-ing the first 5 or so records work?

@efiring
Copy link
Member

efiring commented Sep 2, 2012

I ignored the security warning and followed the instructions of @elpres--but I get a nice plot with no errors, so I can't reproduce the problem. (mpl master, python 2.7.3)

@elpres
Copy link
Contributor Author

elpres commented Sep 3, 2012

Thanks for picking this up. I've just tested it again and everything worked fine, so whatever caused the problem seems to have been fixed in either the MPL update from 1.1.0 to 1.1.1 or Python 2.7.2 to 2.7.3.

And sorry about causing fears about malicious pickle content; I didn't know about the possible security risks and it seemed as the easiest way to provide exactly the same dataset. Is there any other way to serialize Python objects other than dumping them as text (which is not lossless) and parsing back in?

@pelson
Copy link
Member

pelson commented Sep 3, 2012

@elpres : No problems at all. Most importantly, thank you for taking the time to report the issue.
@efiring : You know how to live life on the edge ;-)

Since its all working nicely, I will close the issue.

@pelson pelson closed this as completed Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants