【问题标题】:How do I set VsCode launch.json for python debugging of specific function among others?如何为特定功能的 python 调试设置 VsCode launch.json?
【发布时间】:2021-03-08 17:44:14
【问题描述】:

假设我的 python 脚本有:

def func1():
   <body>
def func2():
   <body>
...
def funcN():
   <body>

我想将我的 VsCode 调试器设置为单步执行 funcN

我查看了https://code.visualstudio.com/docs/python/debugging,但我只能看到要调试的文件(假设我猜是单个函数)

"program": "${file}",

但我不知道在请求的场景下应该如何完成

我尝试设置断点并像那样介入,但没有奏效 - 可行吗?我应该如何配置 launch.json 文件来启用它?

【问题讨论】:

  • I tried putting breakpoints and step in like that, but it didn't work - 你能详细说明一下吗?当我在函数套件/主体的第一行放置断点时,它对我有用。
  • 我在函数 def 行和正文第一行放了断点,它在 def 中停止,但没有进入/进入正文

标签: python visual-studio-code


【解决方案1】:

在调用funN() 的行设置断点。开始调试并进入函数:

参考:Debug ActionsPython Debug Configurations

【讨论】:

    猜你喜欢
    • 2019-01-24
    • 1970-01-01
    • 2020-12-02
    • 1970-01-01
    • 2021-10-22
    • 1970-01-01
    • 2021-08-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多