[IPython-User] stop running cell by conditon

Aaron Meurer asmeurer@gmail....
Mon Sep 16 18:08:18 CDT 2013


On Mon, Sep 16, 2013 at 3:02 PM, Chao YUE <chaoyuejoy@gmail.com> wrote:
> Hi all there,
>
> thanks a lot for you guys all the suggestions. Yes, I have the "Run All
> Above" because I am using ipython 1.0
> The idea for this question is indeed that I want a cleaner screen when some
> exceptions are intended to be
> raised
>
> The strange thing is that none of the cases raised by you works for me. It
> seems that
> any exeption will work when the exception is raised as the LAST exception of
> the notebook cells,
> but if it's placed in the middle, it doesn't work. The exception itself will
> be raised but all the following
> cells will be executed as well.

I also don't reproduce that. As soon as the exception is raised, it
stops, even in the middle of a cell.

It sounds like you're hitting a bug, but one (rather abrupt) way to
stop execution is to type exit(). This will kill the kernel, which
will certainly prevent additional cells from running!

Aaron Meurer

>
> No bother anymore please, not a huge useful user case anyway. But thanks to
> all!
>
> cheers,
>
> Chao
>
>
> On Mon, Sep 16, 2013 at 7:56 PM, Paul Hobson <pmhobson@gmail.com> wrote:
>>
>>
>>
>>
>> On Mon, Sep 16, 2013 at 10:04 AM, Jon Wilson <jsw@fnal.gov> wrote:
>>>
>>> I often use
>>>
>>> assert False
>>>
>>> in a cell when I don't want "Run all cells" to continue past that point.
>>> This doesn't give a very informative error message, of course, but it gets
>>> the job done.
>>> Regards,
>>> Jon
>>>
>>
>> To this end, the latest version of the Notebook has a "Run All Above" item
>> in the Cells menu. (Just FYI). There's also "Run All Below".
>> -p
>>
>>
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>
>
>
> --
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> ************************************************************************************
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>


More information about the IPython-User mailing list