python - 在 macOS Catalina 上使用“使用进程 ID 附加”在 VSCodium 中调试 Python 超时
问题描述
我正在尝试将 VSCodium(基本上是没有 MS 跟踪的 VSCode)附加到正在运行的进程,但不断收到“等待调试服务器连接超时”错误消息。里面的日志~/.vscode-oss/extensions/ms-python.python-2020.8.105369
不再提供更多信息。
该文档看起来应该可以正常工作,并且之前已经为其他人工作过。macOS Catalina (10.15.7) 中是否发生了一些变化,可能是权限问题?还是我完全错过了其他东西?
这是我的launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach using Process Id",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}",
"logToFile": true
}
]
}
解决方案
不知道我当时做了什么,但现在这行得通:
将以下内容添加到代码中:
import debugpy debugpy.listen(5678) debugpy.wait_for_client() debugpy.breakpoint()
运行
使用 VSCodium 的“Attach using Process Id”并搜索运行代码
推荐阅读
- python - 将我的数据集存储在 sagemaker 中的笔记本实例中是个好主意吗?
- database - 是否可以在不重新部署的情况下编辑已部署的 Heroku SQLite3 数据库?
- ios - iOS:从视图控制器中解耦 HTTP 请求
- intellij-idea - 创建后新类变绿(IntelliJ)
- google-apps-script - 在 Google 应用脚本中使用 spacy 返回错误
- python - 在字典中查找列表的最小值
- css - 在可折叠表中使用刀片 foreach 指令时出现问题
- node.js - 将 node.js 模块动态加载到作为 Lambda 函数运行的另一个 node.js 模块中
- codeigniter - Codeigniter 4 - 在 routes.php 中重定向
- apache-kafka - 在pyflink中访问kafka时间戳