I have been trying to figure out how to use pdb to correct simple errors in a file and then continue with program execution. Perhaps someone can tell me why this is not working for me.
Here is my file test.py: #------------------ import pdb pdb.set_trace() print """ this is a test file """ x = 0 y = 4.2 z = y/x print z print "with a bug" #------------------ The line `z = y/x` fails because x is zero. If I run this, I can step until that exception occurs, at which point I see ZeroDivisionError: 'float division' > c:\temp\test.py(9)<module>() -> z = y/x (Pdb) Now, I thought I would be able to set x to another value and then jump back to re-run the line with the division statement. However, that does not seem to work. Here's what happens: (Pdb) !x = 2 (Pdb) j 9 > c:\temp\test.py(9)<module>() -> z = y/x (Pdb) n --Return-- > c:\temp\test.py(9)<module>()->None -> z = y/x (Pdb) n Traceback (most recent call last): File "C:\temp\test.py", line 9, in <module> z = y/x ZeroDivisionError: float division I have also tried assigning a value to z and jumping past the illegal division, but I can't get that to work either. It seems that there must be a way to do this, but I can't find it. Any help would be appreciated. -- http://mail.python.org/mailman/listinfo/python-list