Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there "set -e" equivalent for ipython

set -e at the beginning of the bash script instructs bash to fail the whole script on first failure of any command inside.

Is there any equivalent to use with ipython script which invokes bash commands through !command?

like image 243
kamilpp Avatar asked Apr 28 '26 14:04

kamilpp


1 Answers

As noted in check the exit status of last command in ipython, there is an _exit_code variable. What you want to do is thus equivalent to adding an assert _exit_code==0 after each shell command. I have not found a feature to do the check automatically, but I'm not that familiar with ipython.

like image 96
Yann Vernier Avatar answered Apr 30 '26 06:04

Yann Vernier