diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index aa2d55f..6d0bbad 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2675,10 +2675,11 @@ class InteractiveShell(SingletonConfigurable): # 0 # For other exit status, we show the exception unless # explicitly silenced, but only in short form. - if kw['raise_exceptions']: - raise - if status.code and not kw['exit_ignore']: - self.showtraceback(exception_only=True) + if status.code: + if kw['raise_exceptions']: + raise + if not kw['exit_ignore']: + self.showtraceback(exception_only=True) except: if kw['raise_exceptions']: raise diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index 4758c8d..1afbcb0 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -345,7 +345,8 @@ class InteractiveShellApp(Configurable): # default to python, even without extension self.shell.safe_execfile(full_filename, self.shell.user_ns, - shell_futures=shell_futures) + shell_futures=shell_futures, + raise_exceptions=True) finally: sys.argv = save_argv @@ -415,9 +416,8 @@ class InteractiveShellApp(Configurable): try: self._exec_file(fname, shell_futures=True) except: - self.log.warn("Error in executing file in user namespace: %s" % - fname) - self.shell.showtraceback() + self.shell.showtraceback(tb_offset=4) + self.exit(1) def _run_module(self): """Run module specified at the command-line."""