Reputation: 8337
One can set a breakpoint in IPython
+ pdb
like this:
run -d -b 150 file1.py
That would break the execution of file1.py
at line 150.
Now, how can one set a break point in a file that is being called by file1.py
? Something like the following:
run -d -b file2.py:106 file1.py
where file2.py
is imported and called inside file1.py
.
Many thanks.
Upvotes: 13
Views: 4436
Reputation: 39356
One option which you might find workable would be to make file1.py
into an IPython script, that is, change the name to file1.ipy
, and then, instead of
import file2
do
%run -d -b 106 file2.py
I realize this might not be ideal as it requires editing file1.py
.
edit: This would indeed be a useful feature in the %run
command. I have added it here: https://github.com/ellbur/ipython
Also if you have a solution using pdb
you might want to post that as an answer as well.
Upvotes: 5