python - ipdb / set_trace() bug on Windows? -


i getting strange output when running python script , setting break point ipdb in program:

import sys import ipdb parents, babies = (1, 1) while babies < 100:     ipdb.set_trace()     print 'this generation has {0} babies'.format(babies)     ipdb.set_trace()     parents, babies = (babies, parents + babies) 

it works fine when running script @ first, stopping @ first break point , printing variables. approach second break point doesn't matter if step through or continue, these kind of weird characters output in console:

c:\pythontest>python ipdb_test2.py > c:\pythontest\ipdb_test2.py(6)<module>()       5         ipdb.set_trace() ----> 6         print 'this generation has {0} babies'.format(babies)       7         ipdb.set_trace()  ipdb> n generation has 1 babies > c:\pythontest\ipdb_test2.py(7)<module>()       6         print 'this generation has {0} babies'.format(babies) ----> 7         ipdb.set_trace()       8         parents, babies = (babies, parents + babies)  ipdb> n > ←[1;32mc:\pythontest\ipdb_test2.py←[0m(8)←[0;36m<module>←[1;34m()←[0m ←[1;32m      6 ←[1;33m        ←[1;32mprint←[0m ←[1;34m'this generation has {0} b abies'←[0m←[1;33m.←[0m←[0mformat←[0m←[1;33m(←[0m←[0mbabies←[0m←[1;33m)←[0m←[1;33 m←[0m←[0m ←[0m←[1;32m      7 ←[1;33m        ←[0mipdb←[0m←[1;33m.←[0m←[0mset_trace←[0m←[1;3 3m(←[0m←[1;33m)←[0m←[1;33m←[0m←[0m ←[0m←[1;32m----> 8 ←[1;33m        ←[0mparents←[0m←[1;33m,←[0m ←[0mbabies←[0m ←[1 ;33m=←[0m ←[1;33m(←[0m←[0mbabies←[0m←[1;33m,←[0m ←[0mparents←[0m ←[1;33m+←[0m ←[ 0mbabies←[0m←[1;33m)←[0m←[1;33m←[0m←[0m ←[0m ipdb> n > ←[1;32mc:\pythontest\ipdb_test2.py←[0m(4)←[0;36m<module>←[1;34m()←[0m ←[1;32m      3 ←[1;33m←[0mparents←[0m←[1;33m,←[0m ←[0mbabies←[0m ←[1;33m=←[0m ←[ 1;33m(←[0m←[1;36m1←[0m←[1;33m,←[0m ←[1;36m1←[0m←[1;33m)←[0m←[1;33m←[0m←[0m ←[0m←[1;32m----> 4 ←[1;33m←[1;32mwhile←[0m ←[0mbabies←[0m ←[1;33m<←[0m ←[1;36m10 0←[0m←[1;33m:←[0m←[1;33m←[0m←[0m ←[0m←[1;32m      5 ←[1;33m        ←[0mipdb←[0m←[1;33m.←[0m←[0mset_trace←[0m←[1;3 3m(←[0m←[1;33m)←[0m←[1;33m←[0m←[0m ←[0m ipdb> 

as hit ipdb.set_trace() command second time output these kind of characters , point on debugger becomes unusable. tried on different consoles error seems persist.

i using python 2.7.8 anaconda 2.1.0 (64 bit) on windows, ideas how solve problem warmly welcomed.

the strange output ansi escape codes. that's how ipdb syntax highlighting. cmd windows don't support escape codes default, it's been way since dos days. have enable special driver named ansi.sys control codes work. ipdb must pulling kind of magic breaks second time call set_trace().


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -