From: Michael D. <md...@st...> - 2011-08-25 17:39:32
|
On 08/24/2011 01:41 PM, Michael Droettboom wrote: > On 08/24/2011 11:07 AM, Grahame Bowland wrote: > >> Another thing - I think I've found a str/bytes bug which I can't >> figure it out. I've attached the code, if I run it on my machine I get >> this output: >> >> Traceback (most recent call last): >> File "crash.py", line 24, in<module> >> fig.canvas.print_figure(open('test.png', 'wb'), bbox_inches='tight') >> File "/opt/shrubbery/lib/python3.2/site-packages/matplotlib/backend_bases.py", >> line 1951, in print_figure >> bbox_inches = self.figure.get_tightbbox(renderer) >> File "/opt/shrubbery/lib/python3.2/site-packages/matplotlib/figure.py", >> line 1292, in get_tightbbox >> for ax in self.axes: >> File "/opt/shrubbery/lib/python3.2/site-packages/matplotlib/figure.py", >> line 290, in _get_axes >> return self._axstack.as_list() >> File "/opt/shrubbery/lib/python3.2/site-packages/matplotlib/figure.py", >> line 59, in as_list >> ia_list = [a for k, a in self._elements] >> File "/opt/shrubbery/lib/python3.2/site-packages/matplotlib/figure.py", >> line 59, in<listcomp> >> ia_list = [a for k, a in self._elements] >> TypeError: string argument expected, got 'bytes' >> >> It's definitely something to do with the bbox_inches='tight' argument, >> if I take that out everything works. Using the debugger I can't see >> anything in any stack frame that explains the traceback - really odd! >> > Can you file an issue for this in the matplotlib-py3 github project? > I'm busy getting the matplotlib 1.1.x release finished up at the moment, > and don't have a working environment for Python 3 right now. I'd hate > for this bug to fall through the cracks. > Indeed a confusing bug -- errors were not being returned correctly from the PNG extension. Can you confirm that https://github.com/matplotlib/matplotlib-py3/commit/927acf856bb321e22938846bb39f8b32d90172d4 resolves the issue? Mike |