From d306e585bb37e4d1143598903e96abb386b222be 2011-07-11 19:13:06 From: MinRK Date: 2011-07-11 19:13:06 Subject: [PATCH] exec_files works when specified in config file also don't treat IOError (file not found) as an unknown failure. closes gh-566 --- diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index fca17f1..863e06c 100755 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -187,11 +187,15 @@ class InteractiveShellApp(Configurable): self.shell.showtraceback() def _exec_file(self, fname): - full_filename = filefind(fname, [u'.', self.ipython_dir]) + try: + full_filename = filefind(fname, [u'.', self.ipython_dir]) + except IOError as e: + self.log.warn("File not found: %r"%fname) + return # Make sure that the running script gets a proper sys.argv as if it # were run from a system shell. save_argv = sys.argv - sys.argv = sys.argv[sys.argv.index(fname):] + sys.argv = [full_filename] + self.extra_args[1:] try: if os.path.isfile(full_filename): if full_filename.endswith('.ipy'):