From e697dfcf32df11132f4a17fba7302e3980f4c00f 2016-02-12 11:01:11 From: Min RK Date: 2016-02-12 11:01:11 Subject: [PATCH] only exit on error if `interact` is False --- diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index 6d50e0c..2b6b29c 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -413,6 +413,8 @@ class InteractiveShellApp(Configurable): self.log.warning("Error in executing line in user namespace: %s" % line) self.shell.showtraceback() + if not self.interact: + self.exit(1) # Like Python itself, ignore the second if the first of these is present elif self.file_to_run: @@ -421,7 +423,8 @@ class InteractiveShellApp(Configurable): self._exec_file(fname, shell_futures=True) except: self.shell.showtraceback(tb_offset=4) - self.exit(1) + if not self.interact: + self.exit(1) def _run_module(self): """Run module specified at the command-line."""