簡體   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