Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Debug fails in python jupyter notebook where cells have `execution_count: null`

未关闭
#1,669 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
jupyter-notebook, python
领域
devtools

调研方向

首先,使用包含一个 execution_count 为 null 的单元格的 notebook 重现该失败,然后按照报告中的说明,通过 debugpy/server/cli.py 和 pydevd_runpy.py 跟踪运行过程。完成的标准是,这样的 notebook 可以启动进行调试,而不会出现由 JSON null 值导致的 NameError。

由索引模型根据 Issue 内容生成。

描述

bug needs repro

I have notebooks which have cells having the json attribute "execution_count" set to null.
This is common with tools, such as nbdev-clean which attempt to reduce diff-noise when saving notebooks in source control.

Unfortunately, it seems to make it impossible to debug in such notebooks from within VS Code's Python extension.

Here is a trace:

cd /home/user/project ; /usr/bin/env /opt/mambaforge/envs/orion/bin/python /home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 47789 -- /home/user/project/ml_ann_experiments.ipynb 
Traceback (most recent call last):
  File "/opt/mambaforge/envs/orion/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/mambaforge/envs/orion/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/home/user/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/home/user/project/a_notebook.ipynb", line 427, in <module>
    "execution_count": null,
NameError: name 'null' is not defined

Here are software info:

VS Code
Version: 1.92.2
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z (4 wks ago)
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.92.2 Chrome/124.0.6367.243 Electron/30.1.2 Safari/537.36

Python Extension
Published 2016-01-19, 16:03:11
Last released 2024-09-05, 23:24:18
Last updated 2024-09-06, 07:23:15
Identifier ms-python.python

Python Debugger
Published 2023-06-14, 20:20:56
Last released 2024-08-29, 12:33:08
Last updated 2024-08-14, 22:13:57
Identifier ms-python.debugpy

python 3.10.13
ipython 8.15.0
debugpy 1.6.7

I'm running on linux mint 21.2

主要语言
Python
星标
2.5k
派生
202
平均合并
5 天 1 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/debugpy 的其他 Issue

查看 microsoft/debugpy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。