1
""" Debug a script (like %run -d) in IPython process, Using WinPdb
6
run test.py, with a winpdb breakpoint at start of the file
9
Change the password (e.g. if you have forgotten the old one)
17
ip = IPython.ipapi.get()
22
""" Debug a script (like %run -d) in IPython process, Using WinPdb
27
run test.py, with a winpdb breakpoint at start of the file
30
Change the password (e.g. if you have forgotten the old one)
32
Note that after the script has been run, you need to do "Go" (f5)
33
in WinPdb to resume normal IPython operation.
41
if arg.strip() == 'pass':
42
passwd = raw_input('Enter new winpdb session password: ')
43
ip.db['winpdb_pass'] = passwd
44
print "Winpdb password changed"
46
print "You need to restart IPython to use the new password"
49
path = os.path.abspath(arg)
50
if not os.path.isfile(path):
51
raise IPython.ipapi.UsageError("%%wdb: file %s does not exist" % path)
53
passwd = ip.db.get('winpdb_pass', None)
56
print textwrap.dedent("""\
57
Winpdb sessions need a password that you use for attaching the external
58
winpdb session. IPython will remember this. You can change the password later
61
passwd = raw_input('Enter new winpdb session password: ')
62
ip.db['winpdb_pass'] = passwd
64
print "Starting rpdb2 in IPython process"
65
rpdb2.start_embedded_debugger(passwd, timeout = 0)
68
rpdb2.set_temp_breakpoint(path)
69
print 'It is time to attach with WinPdb (launch WinPdb if needed, File -> Attach)'
70
ip.magic('%run ' + arg)
73
ip.expose_magic('wdb', wdb_f)