jupyterlab / jupyterlab

JupyterLab computational environment.
https://jupyterlab.readthedocs.io/
Other
14.23k stars 3.41k forks source link

Render Variable in Debugger fails with infinite loader #16973

Open Enum0 opened 1 week ago

Enum0 commented 1 week ago

Description

Bebugger fails rendering variables for 'self' objects. Instead of variable value it displays an infinite loader.

As a workaround I use 'copy to clipboard' option, which is a bit inconvinient.

I found the similar issue https://github.com/jupyterlab/jupyterlab/issues/11009, which was resolved in 2022. But looks like it is here again.

image

Reproduce

  1. Create a class with private attribute and some method. Create an instance of this class.
  2. Turn on the debug mode.
  3. Add a new line and mark it as a breakpoint: call the method of this instance.
  4. Go to the variable inspector, right-click on this variable in the self object. Click 'render variable'.
  5. It opens the new tab with infinite loader instead of variable value.

Expected behavior

The variable is rendered.

Context

Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.

3coins commented 1 week ago

I am able to reproduce this issue in JupyterLab v4.3.1, and this seems to happen with any variable of the class not just private ones. Here is the stack trace from the kernel error.

[IPKernelApp] ERROR | Exception in control handler:
Traceback (most recent call last):
  File "/Users/pijain/miniforge3/envs/jupyter-ai/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 362, in process_control
    await result
  File "/Users/pijain/miniforge3/envs/jupyter-ai/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 1039, in debug_request
    reply_content = await reply_content
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/pijain/miniforge3/envs/jupyter-ai/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 533, in do_debug_request
    return await self.debugger.process_request(msg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pijain/miniforge3/envs/jupyter-ai/lib/python3.11/site-packages/ipykernel/debugger.py", line 731, in process_request
    reply = await handler(message)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pijain/miniforge3/envs/jupyter-ai/lib/python3.11/site-packages/ipykernel/debugger.py", line 664, in richInspectVariables
    repr_data, repr_metadata = eval(reply["body"]["result"], {}, {})
    ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NameError object