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 fd95390 commit e5effe0eb43d57e3a34a9dd07a0c03e3a178b2f2 @tomspur tomspur committed with fperez 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 e5effe0

Please sign in to comment.