jupyter_server: Printing emojis breaks the kernel

Description

Printing an emoji breaks the kernel with jupyter-server HEAD. It was working with former version of jupyter-server (9 months ago).

Reproduce

Run print("šŸ˜") in a notebook and get the following error.

W 2022-05-26 12:08:30.762 ServerApp] Got events for closed stream <zmq.eventloop.zmqstream.ZMQStream object at 0x10731d6d0>
[IPKernelApp] ERROR | Invalid Message
Traceback (most recent call last):
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 359, in dispatch_shell
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/site-packages/ipykernel/kernelbase.py", line 359, in dispatch_shell
    msg = self.session.deserialize(msg, content=True, copy=False)
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/site-packages/jupyter_client/session.py", line 1066, in deserialize
    message["content"] = self.unpack(msg_list[4])
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/site-packages/jupyter_client/session.py", line 127, in json_unpacker
    return json.loads(s)
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/echarles/opt/miniconda3/envs/datalayer/lib/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 107 (char 106)

</details>

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I’m AFK until next Wednesday so am unable to help look into things more closely.

@kevin-bates Have a good time off. Thx!

@davidbrochart @kevin-bates I have tested in a fresh env, and indeed it works fine.

I leave this open a bit more while investigating what may cause that issue in my other env. But looks like all good with jupyter-server and that is the issue is on my side. Thx again.

Thx @kevin-bates I will try to downgrade jupyter_client to confirm if this fixes the issue. I think however yesterday I tried with the same jupyter_client version, and changing jupyter_server version only were giving the issue. Let me check.