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