I'm trying to become more adept at using the debugger, and am following the examples given in http://www.onlamp.com/pub/a/python/2005/09/01/debugger.html. I'm currently trying this script:
#!/usr/bin/env python
import ipdb
def test_debugger(some_int):
print "start some int>>", some_int
return_int = 10 / some_int
print "end some_int>>", some_int
return return_int
if __name__ == "__main__":
ipdb.run("test_debugger(0)")
However, if I run it and try to press n
, I get a NameError
:
> <string>(1)<module>()
ipdb> n
NameError: "name 'test_debugger' is not defined"
As I understand from https://docs.python.org/2/library/pdb.html#pdb.run, it should be possible to use the n(ext)
command to run until the actual bug. Can someone explain what is going on here?