From 1e6139c81e9acd5d2c771b0718f6f4b8592892e3 2020-01-07 15:43:21 From: Jeff Potter Date: 2020-01-07 15:43:21 Subject: [PATCH] Exit non-zero when ipython is given a file path to run that doesn't exist --- diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index a09192f..3147c59 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -404,6 +404,9 @@ class InteractiveShellApp(Configurable): fname = self.file_to_run if os.path.isdir(fname): fname = os.path.join(fname, "__main__.py") + if not os.path.exists(fname): + self.log.warning("File '%s' doesn't exist", fname) + self.exit(2) try: self._exec_file(fname, shell_futures=True) except: