debugging 添加“justMyCode”时未定义错误名称“false”:使用参数运行我的调试器时,Visual Studio代码中的launch.json为false [duplicate]

5rgfhyps  于 2022-11-24  发布在  其他
关注(0)|答案(1)|浏览(160)

此问题在此处已有答案

Python JSON: NameError: name 'false' is not defined(3个答案)
7天前关闭。
添加“justMyCode”时未定义名称“false”:在Visual Studio代码3中为false执行launch.json
在python中调试我的程序时遇到这个错误,我尝试使用配置中显示的这些参数运行

"configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": [
                "main.py",
                "--run_mode",
                "testing",
                "--uni_name",
                "greenwich",
                "--env",
                "local_development"
            ],
        },

我不确定问题是什么,下面是一个非常类似问题的答案,
“此配置触发当前聚焦文件的运行或调试(请参见“名称”:“Python:当前文件”和“程序”:“${file}”设置)并弹出错误消息,因为您试图调试launch.json文件-这对于python调试器没有意义。
换句话说-首先,你必须切换到/focus你的python文件,然后触发debug。
但老实说,这个答案对我来说毫无意义。我不明白这里说的是什么{首先,你必须切换到/focus你的python文件,然后触发调试}如果有人能帮助我,我将非常感激。
已尝试使用配置运行调试器

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": [
                "--run_mode",
                "testing",
                "--uni_name",
                "greenwich",
                "--env",
                "local_development"
            ],
        }

获取此错误

Exception has occurred: NameError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
name 'false' is not defined
krugob8w

krugob8w1#

这是有效的,

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "main.py",
            "console": "integratedTerminal",
            "justMyCode": false,
            "args": [
                "--run_mode",
                "testing",
                "--uni_name",
                "greenwich",
                "--env",
                "local_development"
            ]
        }
    ]
}

the value in the program argument needed to be the file in which to launch I assume,

Thank you !

相关问题