ipykernel icon indicating copy to clipboard operation
ipykernel copied to clipboard

Debugger: Can't clean for JSON Error

Open mlucool opened this issue 4 years ago • 4 comments
trafficstars

Hi,

I am seeing the following error on master.

Create a notebook with:

class Foo(object):
    pass
Foo()

Run the cell. Then try to start the debugger. It fails with this in stdout of jupyter:

[IPKernelApp] ERROR | Exception in control handler:
Traceback (most recent call last):
  File "/path/to/lib64/python3.7/site-packages/ipykernel/kernelbase.py", line 243, in process_control
    yield gen.maybe_future(handler(self.control_stream, idents, msg))
  File "/path/to/lib64/python3.7/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/path/to/lib64/python3.7/site-packages/tornado/gen.py", line 775, in run
    yielded = self.gen.send(value)
  File "/path/to/lib64/python3.7/site-packages/ipykernel/kernelbase.py", line 757, in debug_request
    reply_content = json_clean(reply_content)
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 142, in json_clean
    out[str(k)] = json_clean(v)
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 142, in json_clean
    out[str(k)] = json_clean(v)
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 128, in json_clean
    return [json_clean(x) for x in obj]
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 128, in <listcomp>
    return [json_clean(x) for x in obj]
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 142, in json_clean
    out[str(k)] = json_clean(v)
  File "/path/to/lib64/python3.7/site-packages/ipykernel/jsonutil.py", line 148, in json_clean
    raise ValueError("Can't clean for JSON: %r" % obj)
ValueError: Can't clean for JSON: <class '__main__.Foo'>

mlucool avatar Apr 22 '21 21:04 mlucool

Hey @mlucool thanks for posting.

I cannot reproduce this issue. Could you please report if you are still seeing this with the latest prerelease?

SylvainCorlay avatar May 06 '21 09:05 SylvainCorlay

LGTM

mlucool avatar May 07 '21 21:05 mlucool

Reopening this.

I am struggling to make a reproducer outside of one of my environments, so I suspect I need to upgrade some package (or some lib is interfering).

My minimal reproducer is:

import sys

sys.path.append('/path/to/lib')
from foo import Example
Example()

Where /path/to/lib is:

$ ls foo/
__init__.py 
$ cat foo/__init__.py 
class Example(object):
    pass

What this leads to is if anything similar to this is done before I start the debugger, the debugger cannot start.

Any idea on which package(s) may need to be upgraded?

Do you have any tips on how to debug ipykernel itself so I can try and trace where this starts/debug what is different my envs?

mlucool avatar Jun 28 '21 23:06 mlucool

A3 Value encryption with sha265 In 00:00 loopback NCAP

protechq88 avatar Oct 14 '22 07:10 protechq88