diff options
author | gbrandl <devnull@localhost> | 2007-01-25 20:00:35 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-01-25 20:00:35 +0100 |
commit | 1699701fd132c19974be66c5664a88a90a32a3d2 (patch) | |
tree | 7163ddc984cb36c862979a5f5f86bc4a4e85eaff /pygments/cmdline.py | |
parent | 8661de37c9a04da977fd8da8542e36115ee83fb2 (diff) | |
download | pygments-1699701fd132c19974be66c5664a88a90a32a3d2.tar.gz |
[svn] - add missing example files
- add "outencoding" option to formatters
- improve cmdline error reporting
Diffstat (limited to 'pygments/cmdline.py')
-rw-r--r-- | pygments/cmdline.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pygments/cmdline.py b/pygments/cmdline.py index b70d9e6d..002117d4 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -228,8 +228,14 @@ def main(args): highlight(code, lexer, fmter, outfile) except Exception, err: import traceback - print >>sys.stderr, 'Error while highlighting:' - print >>sys.stderr, traceback.format_exc(0).splitlines()[-1] + info = traceback.format_exception(*sys.exc_info()) + msg = info[-1].strip() + if len(info) >= 3: + # extract relevant file and position info + msg += '\n (f%s)' % info[-2].split('\n')[0].strip()[1:] + print >>sys.stderr + print >>sys.stderr, '*** Error while highlighting:' + print >>sys.stderr, msg return 1 return 0 |