Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 5c4429abba600a474defdfed40eacf45dc076971 1 parent bd2a307
@tomspur authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 IPython/utils/PyColorize.py
View
6 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.
Something went wrong with that request. Please try again.