Permalink
Browse files

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 <tomspur@fedoraproject.org>
  • Loading branch information...
1 parent bd2a307 commit 5c4429abba600a474defdfed40eacf45dc076971 @tomspur committed Nov 2, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 IPython/utils/PyColorize.py
@@ -277,7 +277,11 @@ def main(argv=None):
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()

0 comments on commit 5c4429a

Please sign in to comment.