Posted on 2014-01-28 12:47:57 python
我们都知道,python里面可以用pdb来调试代码。但是pdb往往不大好用。有时候调试代码往往在多重条件里面,直接用pdb需要下条件断点,设定复杂的条件。
一个简单的办法就是这么干。
__import__('pdb').set_trace()
但是有的时候,连这个出现的条件都不满足。例如,代码必须在一个受限环境中运行,很难拿到console,或者其他林林总总的毛病。这时候,我们还有一招秘技。
import pdb, socket
s = socket.socket()
s.connect(('127.0.0.1', 8888))
f = s.makefile()
pdb.Pdb(stdin=f, stdout=f).set_trace()
在连接到的目标端口上,提前用nc做好监听,就可以在触发断点的时候直接连接上来调试。
Whoever wrote this, you know how to make a good artelci.
play online casino big fish casino free casino slot games
slots free http://onlinecasinogamespcx.com/ - casino real money online casino bonus world class casino slots online casino games
slots for real money online casino slots world class casino slots slot games http://onlinecasinosw.com/ - vegas casino slots
free slots games free slots games online gambling
http://onlinecasinosw.com/ online casino bonus http://onlinecasinosw.com/ - slots games free vegas slots online
casino play slots free play casino free casino games online
online casino games http://casinorealmoneyfdr.com/ - free slots online slot games real casino slots
cbd pure http://buycbdoil11.com/ - hemp oil hemp oil medterra cbd
hemp cbd http://buycbdoil11.com/ - cbd oil cbd capsules buy hemp oil cbd oil for dogs