[IPython-User] stop running cell by conditon

Jeffrey Bush jeff@coderforlife....
Mon Sep 16 11:59:40 CDT 2013


The Interrupt Kernel menu option uses a KeyboardInterrupt exception - the
same thing a CTRL+C would do in a regular Python program. You could throw
one of those probably.

Jeff

On Monday, September 16, 2013, Chao YUE wrote:

> Dear all,
>
> I would like to let the notebook to stop at some cell when some conditions
> are met,
> so that the notebook does not try to execute the following cells.
> something like:
>
> a = 4
> if a !=3:
>     raise SomeError
>
> But I tried both "RuntimeError" and "Stopiteration" as "SomeError" above,
> neither of them works. The following cells are still tried to be executed
> by
> the notebook.
>
> does anyone have some solution? thanks!
>
> cheers,
>
> Chao
>
> --
>
> ***********************************************************************************
> 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
>
> ************************************************************************************D
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130916/b004e252/attachment-0001.html 


More information about the IPython-User mailing list