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

svgwriter not assigned in FigureCanvasSVG.print_svg for StringIO filename #1373

Closed
cjmayo opened this issue Oct 13, 2012 · 1 comment
Closed
Milestone

Comments

@cjmayo
Copy link

cjmayo commented Oct 13, 2012

matplotlib-1.2.0rc2

#!/usr/bin/python2

from io import StringIO

from matplotlib.backends.backend_svg import FigureCanvasSVG
from matplotlib.figure import Figure

output = StringIO()
fig = Figure()
canvas = FigureCanvasSVG(fig)
canvas.print_svg(output)
Traceback (most recent call last):
  File "./print_svg.py", line 11, in <module>
    canvas.print_svg(output)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_svg.py", line 1101, in print_svg
    return self._print_svg(filename, svgwriter, fh_to_close, **kwargs)
UnboundLocalError: local variable 'svgwriter' referenced before assignment

using BytesIO() instead works fine.

@dmcdougall
Copy link
Member

Resolved by #1380. Closing.

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

2 participants