如何使用 idle3 处理多个源文件调试?

How to handle multiple source-files debugging with idle3?

我知道如何调试单个文件,但目前导入文件上的断点不起作用。

test1.py

import test2

print(do_stuff)

test2.py

def do_stuff():
   str = "hello world" # <- set breakpoint here
   return str

在idle3中test2.py和运行test1.py设置断点时,程序不停止。如何处理多源文件调试?

您的代码有问题,因为它从不 运行 带有断点的行,断点位于未调用的函数内。我刚刚在 Windows 上的 3.5.4 和 3.7.0b1 中进行了测试,导入文件中的断点工作正常。

# a/tem.py (in path)
a = 3
b = 4  # breakpoint
def c():
    d = 5  # breakpoint
    return 'c ran'

# a/tem2.py
from a.tem import c
print(c)
print(c())

# prints
<function c at 0x0000023921979840>
c ran

运行 不同 IDE 中的错误代码不会神奇地实现 运行.