Modified patch from upstream (PyColorize.py was moved): commit e5effe0eb43d57e3a34a9dd07a0c03e3a178b2f2 Author: Thomas Spura Date: Tue Nov 2 10:19:58 2010 +0100 pycolor: Wrong filename given -> print error When a user wanted to colorize a file, which doesn't exist, IPython would crash. This commit changes this, so the user gets a usefull message about the wrong filename. This fixes RH bug #628742. Signed-off-by: Thomas Spura diff --git a/IPython/utils/PyColorize.py b/IPython/utils/PyColorize.py index 613ae19..ddf3f7a 100644 --- a/IPython/PyColorize.py +++ b/IPython/PyColorize.py @@ -277,7 +277,11 @@ If no filename is given, or if filename is -, read standard input.""" if fname == '-': stream = sys.stdin else: - stream = file(fname) + try: + stream = file(fname) + except IOError,msg: + print >> sys.stderr, msg + sys.exit(1) parser = Parser()