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'
相关推荐
不学无术の码农16 分钟前
《Effective Python》第1章 Pythonic 思维总结——编写优雅、高效的 Python 代码
开发语言·python
zhou18517 分钟前
MySQL保姆级安装教程(附资源包+5分钟极速配置+环境变量调试技巧)
java·python·mysql·php
lczdyx42 分钟前
PNG转ico图标(支持圆角矩形/方形+透明背景)Python脚本 - 随笔
图像处理·python
妄想成为master1 小时前
拒绝flash插件打劫!如何在vscode上玩4399小游戏
vscode·扩展·4399·4399小游戏
lgily-12251 小时前
常用的设计模式详解
java·后端·python·设计模式
陈苏同学2 小时前
MPC控制器从入门到进阶(小车动态避障变道仿真 - Python)
人工智能·python·机器学习·数学建模·机器人·自动驾驶
mahuifa2 小时前
python实现usb热插拔检测(linux)
linux·服务器·python
MyhEhud2 小时前
kotlin @JvmStatic注解的作用和使用场景
开发语言·python·kotlin
狐凄3 小时前
Python实例题:pygame开发打飞机游戏
python·游戏·pygame
漫谈网络3 小时前
Telnet 类图解析
python·自动化·netdevops·telnetlib·网络自动化运维