2016-07-13 2 views
-1
import pdb 
print("program started") 
c=100 
d=200 
pdb.set_trace() 
def fun(a,b): 
    print a,b 
    return a+b 
fun(c,d) 
for i in [1,2,3,4,5]: 
    print 10/i 
    print ("other statements in program") 
print ("program ended") 
+0

코드를 올바르게 들여 쓰기 할 수 있고 코드로 서식을 지정할 수 있습니까? –

+2

pdb라는 자체 모듈이 있습니까? – Jens

+0

pdb - 파이썬 디버거 @Jens – ViKiG

답변

1

파이썬 모듈 pdbset_trace() 기능이 없다. 프로그램에서 찾지 못하기 때문에 다른 프로그램을 가져 오는 중입니다. 거의 확실하게 프로그램 (또는 같은 디렉토리에있는 다른 프로그램)의 이름은 pdb.py입니다.

0

그것은 당신이 올바른 모듈을 사용하고 있는지 확인하기 위해 도움 (PDB)를 사용하여 대화 형 모드도

`

[[email protected] tmp]# cat test.py 
import json,pdb 
buf = open('./a.txt').read() 
j = json.loads(buf) 
pdb.set_trace() 
print j 
[[email protected] tmp]# python test.py 
> /tmp/test.py(5)<module>() 
-> print j 
(Pdb) list 
    1  import json,pdb 
    2  buf = open('./a.txt').read() 
    3  j = json.loads(buf) 
    4  pdb.set_trace() 
    5 -> print j 
[EOF] 

`나를 위해 잘 작동합니다.