繁体   English   中英

如何使用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

在test2.py中设置断点并在idle3中运行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中运行错误代码不会使其神奇地运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM