Vscode | Python | launch.json配置gevent多进程断点失效问题处理

Vscode | Python | launch.json配置gevent多进程断点失效问题处理

文章目录

情况描述

launch.json

json 复制代码
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "运行",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/odoo/odoo-bin",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                "--config",
                "${workspaceFolder}/config/odoo.conf"
            ],
            
        }
    ]
}

在我使用vscode运行Python工程时,console界面中疯狂提示:

text 复制代码
...
It seems that the gevent monkey-patching is being used.
Please set an environment variable with:
GEVENT_SUPPORT=True
to enable gevent support in the debugger.
It seems that the gevent monkey-patching is being used.
Please set an environment variable with:
GEVENT_SUPPORT=True
to enable gevent support in the debugger.
It seems that the gevent monkey-patching is being used.
Please set an environment variable with:
GEVENT_SUPPORT=True
to enable gevent support in the debugger.
It seems that the gevent monkey-patching is being used.
Please set an environment variable with:
GEVENT_SUPPORT=True
to enable gevent support in the debugger.
...

通过网上搜索,说可以在launch.json配置文件中添加"gevent":true,于是添加后不提示了,但是Subprocess的断点却不走了,测来测去就是这个gevent的问题:

  1. 不添加gevent,疯狂提示让我配置环境变量;
  2. 添加了gevent,子进程的断点又不跑;

↓↓↓解决办法直接看这里↓↓↓

launch.json不要添加gevent的配置,在python启动文件上添加:

python 复制代码
__import__('os').environ['GEVENT_SUPPORT'] = 'true'
相关推荐
cwj&xyp23 分钟前
Python(二)str、list、tuple、dict、set
前端·python·算法
是十一月末26 分钟前
Opencv实现图片的边界填充和阈值处理
人工智能·python·opencv·计算机视觉
_oP_i3 小时前
HTTP 请求Media typetext/plain application/json text/json区别
网络协议·http·json
算法小白(真小白)3 小时前
低代码软件搭建自学第二天——构建拖拽功能
python·低代码·pyqt
唐小旭3 小时前
服务器建立-错误:pyenv环境建立后python版本不对
运维·服务器·python
007php0074 小时前
Go语言zero项目部署后启动失败问题分析与解决
java·服务器·网络·python·golang·php·ai编程
Chinese Red Guest4 小时前
python
开发语言·python·pygame
骑个小蜗牛4 小时前
Python 标准库:string——字符串操作
python
黄公子学安全7 小时前
Java的基础概念(一)
java·开发语言·python