Thanks to visit codestin.com
Credit goes to github.com

Skip to content

WebAgg Python3 ... strings again #2832

Closed
@2sn

Description

@2sn

When I use WebAgg in Python3.3 / latest mpl from git I get the error

In [6]: pyplot.show()

TypeError Traceback (most recent call last)
in ()
----> 1 pyplot.show()

/usr/lib64/python3.3/site-packages/matplotlib/pyplot.py in show(_args, *_kw)
147 """
148 global _show
--> 149 return _show(_args, *_kw)
150
151

/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_webagg.py in show()
106 for manager in pylab_helpers.Gcf().get_all_fig_managers():
107 result.append(ipython_inline_display(manager.canvas.figure))
--> 108 return display_html('\n'.join(result), raw=True)
109
110

which is because

In [7]: %debug

/usr/lib64/python3.3/site-packages/matplotlib/backends/backend_webagg.py(108)show()
107 result.append(ipython_inline_display(manager.canvas.figure))
--> 108 return display_html('\n'.join(result), raw=True)
109

ipdb> result
[b'<!-- Within the kernel, we don't know the address of the matplotlib\n websocket server, so we have to get in client-side ...

This can be fixed replacing (line 108 in matplotlib/backends/backend_webagg.py)

    return display_html('\n'.join(result), raw=True)

by

    return display_html('\n'.join([r.decode('us-ascii', 'ignore') for r in result]), raw=True)

-Alexander

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions