From c72cb7c95456f622248408568c65ad9bb5d97be8 2020-01-09 16:09:00 From: Matthias Bussonnier Date: 2020-01-09 16:09:00 Subject: [PATCH] Merge pull request #12074 from jpotter/master 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: