Debugging code in the Python interpreter
debugging, function, functional-testing, interpreter, python
Solution
If you want to debug specific function you can using this -
>>> import pdb
>>> import yourmodule
>>> pdb.run('yourmodule.foo()')
over the command line. `pdb.set_trace()` should be added in your function to break there.
More info on pdb can be seen here - http://docs.python.org/library/pdb.html
Problem
I like testing functions in the Python interpreter. Is it possible to debug a function in the Python interpreter when I want to see more than a return value and a side effect? If so, could you show basic debugger operations (launching the function with arguments, setting breakpoint, next step, step into, watching variable)? If not, how would you debug a function another way? The point is, I want to debug only a particular function which will be supplied with arguments. I don't want to debug whole module code. thank you for advice