Is there a "set -e" equivalent for ipython

set -e

at the beginning of the bash

script instructs bash to crash the entire script the first time any command inside it crashes.

Is there any equivalent for use with a ipython

script that invokes bash commands via !command

?

+3


source to share


1 answer


As noted in check the exit status of the last command in ipython , a variable exists _exit_code

. What you want to do is equivalent to adding assert _exit_code==0

after each shell command. I didn't find a function to do the check automatically, but I'm not familiar with ipython.



+2


source







All Articles