Skip to content

Broken in jupyter console #51

Description

@lukelbd

I get the following traceback in a jupyter console session with the itermplot==0.5 version recommended in the readme. Using pip install --upgrade itermplot to version 0.331 also does not help.

In [1]: fig, ax = plt.subplots()
   ...: fig.show()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [1], in <module>
      1 fig, ax = pplt.subplot()
----> 2 fig.show()

File ~/miniconda3/lib/python3.9/site-packages/matplotlib/figure.py:2364, in Figure.show(self, warn)
   2360     raise AttributeError(
   2361         "Figure.show works only for figures managed by pyplot, "
   2362         "normally created by pyplot.figure()")
   2363 try:
-> 2364     self.canvas.manager.show()
   2365 except NonGuiException as exc:
   2366     if warn:

File ~/miniconda3/lib/python3.9/site-packages/itermplot/__init__.py:298, in ItermplotFigureManager.show(self)
    295     data = self.animate(loops, outfile)
    297 if hasattr(data, "getbuffer"):
--> 298     imgcat(data.getbuffer(), fn)
    299 else:  # Python 2
    300     imgcat(data.getvalue(), fn)

File ~/miniconda3/lib/python3.9/site-packages/itermplot/__init__.py:124, in imgcat(data, fn)
    122     sys.stdout.buffer.write(buf)
    123 else:
--> 124     sys.stdout.write(buf)
    125 sys.stdout.flush()
    127 print()

File ~/miniconda3/lib/python3.9/site-packages/ipykernel/iostream.py:513, in OutStream.write(self, string)
    503 """Write to current stream after encoding if necessary
    504
    505 Returns
   (...)
    509
    510 """
    512 if not isinstance(string, str):
--> 513     raise TypeError(
    514         f"write() argument must be str, not {type(string)}"
    515     )
    517 if self.echo is not None:
    518     try:

TypeError: write() argument must be str, not <class 'bytes'>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions