[IPython-User] stop running cell by conditon

Jon Wilson jsw@fnal....
Mon Sep 16 12:04:33 CDT 2013


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

On 09/16/2013 09:44 AM, 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
>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130916/b328d997/attachment.html 


More information about the IPython-User mailing list