<div dir="ltr">In addition to the above, keep in mind that you can also use '%run -d' to run your code under the control of the debugger with stepping. See %run? for details.<div><br></div><div>Cheers,</div><div><br>

</div><div>f</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 18, 2014 at 12:06 PM, Darlan Cavalcante Moreira <span dir="ltr"><<a href="mailto:darcamo@gmail.com" target="_blank">darcamo@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<a href="mailto:takowl@gmail.com">takowl@gmail.com</a> writes:<br>
<br>
> On 15 July 2014 06:02, Josh Wasserstein <<a href="mailto:ribonucleico@gmail.com">ribonucleico@gmail.com</a>> wrote:<br>
><br>
>> This makes me wonder if:<br>
>><br>
>> 1) I am doing things wrong<br>
>> 2) The current status of IPython does not provide the debugging<br>
>> functionality stated in the OP.<br>
>><br>
>> And the reason behind 2) could be:<br>
>> a. Limitations of Python / execution model that make this inviable<br>
>> b. There is not enough interest to justify an effort to improve the<br>
>> debugging model / the relatively high complexity required to have Python /<br>
>> IPython support this workflow<br>
>><br>
><br>
> There's a distinct possibility that the answer is 2c: The effort is<br>
> justified, but no-one has done it yet.<br>
><br>
> I know several of us on the core team routinely just scatter print<br>
> statements around the code when we want to debug something. Even using a<br>
> post-mortem debugger to go up and down the stack, with no way to step<br>
> through code, seems advanced to me.<br>
><br>
> My personal take on it is that the effort necessary to learn and use a<br>
> command-line debugger isn't really worth it for writing Python code, where<br>
> uncaught errors automatically give you quite a bit of detail on what went<br>
> wrong. I suspect that a good graphical debugger could be useful (I've used<br>
> the JS debugger in Firefox, for instance).<br>
><br>
> Thomas<br>
</div></div>> _______________________________________________<br>
> IPython-dev mailing list<br>
> <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br>
<br>
Debugging in python was annoying to me until I discovered pudb.<br>
<a href="https://pypi.python.org/pypi/pudb" target="_blank">https://pypi.python.org/pypi/pudb</a><br>
<br>
Install it through pip and then add the line below at some point in your<br>
program<br>
    import pudb; pudb.set_trace()<br>
and run it as usual.<br>
<br>
Or you don't add anything and run you program with<br>
pudb my_program.py<br>
<br>
<br>
The advantages of pudb when compared with standard pdb or ipdb is that<br>
it is graphical and much easier to work with. You can step throgh code<br>
with the 'n' key, step inside a function with the 's' key, go up or down<br>
in the stack with 'd' and 'u', etc.<br>
<br>
But the killer feature is the integration with IPython. At any point you<br>
can press '!' to go to an IPython terminal with the current variables<br>
(use Ctrl+D when you are finished to go back to pudb). From there you<br>
can do any test you want. Note that if in pudb you go up in the stack<br>
with the 'u' key and then start IPython with '!' you will have the<br>
variables from that stack.<br>
<br>
There are ther noce features too, such as conditional breakpoints, etc.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Darlan Cavalcante Moreira<br>
<a href="mailto:darcamo@gmail.com">darcamo@gmail.com</a><br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Fernando Perez (@fperez_org; <a href="http://fperez.org" target="_blank">http://fperez.org</a>)<br>fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)<br>

fernando.perez-at-berkeley: contact me here for any direct mail<br>
</div>