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'
相关推荐
codists6 分钟前
lexeme和token
python
天赐范式32 分钟前
天赐范式第182天:让变异开始存活——主线重启与变异存续条件
python·ar模型·数字生命·天赐范式·动态运行时·稳态方差·变异存续
lusklusklusk41 分钟前
Python 四大数据结构详解:元组、列表、集合、字典的特点与增删改查
数据结构·windows·python
打工仔折腾 AI44 分钟前
把模型切换交给平台:用蓝耘智能路由搭建商品评论分析工具
java·服务器·前端·后端·python·性能优化·ai agent 实战
ynchyong1 小时前
python list 地常用操作
开发语言·python
梦在远山后1 小时前
PostgreSQL 锁与死锁:结合 DevMind 讲清楚
python·postgresql·agent
郝学胜_神的一滴1 小时前
AI 编程智能体 01:普通程序员的下一个逆天改命风口
人工智能·python
zh路西法2 小时前
【ResNet18】从图像到视觉特征:卷积神经网络如何理解图像
pytorch·python·神经网络·cnn·resnet·resnet18
外收内放2 小时前
Python基础语法练习题(40-42)
开发语言·python
m0_547486662 小时前
《数据挖掘:理论、方法与实践基于Python语言》全套PPT课件2026(中国地质大学)
人工智能·python·数据挖掘