====== Le debugger Python ======
===== Articles =====
* http://aymanh.com/python-debugging-techniques
===== module trace =====
Le module trace equivant à lancer un script shell avec l'option -x :
root@ks305337:~# python -m trace --trace ./1.py
--- modulename: threading, funcname: settrace
threading.py(90): _trace_hook = func
--- modulename: 1, funcname:
1.py(3): print "hello"
hello
1.py(4): c = 2+2
1.py(5): d = 3 + 3
1.py(6): c, d = d, c
1.py(7): print c,d
6 4
===== module pdb =====
Le module pdb est le mode pas à pas de python :
root@ks305337:~# python -m pdb ./1.py
> /root/1.py(3)()
-> print "hello"
(Pdb) n
hello
> /root/1.py(4)()
-> c = 2+2
(Pdb) n
> /root/1.py(5)()
-> d = 3 + 3
(Pdb) n
> /root/1.py(6)()
-> c, d = d, c
(Pdb) n
> /root/1.py(7)()
-> print c,d
(Pdb) n
6 4
--Return--
> /root/1.py(7)()->None
-> print c,d
(Pdb) n
--Return--
> (1)()->None
(Pdb) n
The program finished and will be restarted