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 7d3c2f4 commit a191f2a5052f70549dac35eb6ef9ca74a9bd4020 @tomspur committed Aug 31, 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 msg
+ return
parser = Parser()

0 comments on commit a191f2a

Please sign in to comment.