summaryrefslogtreecommitdiff
path: root/pygments/cmdline.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-01-25 20:00:35 +0100
committerGeorg Brandl <georg@python.org>2007-01-25 20:00:35 +0100
commitb22c474d1084f5624679c37807dff8f9918388c4 (patch)
tree7163ddc984cb36c862979a5f5f86bc4a4e85eaff /pygments/cmdline.py
parent23991af67b5cb90e860f3625816778112a5622f5 (diff)
downloadpygments-git-b22c474d1084f5624679c37807dff8f9918388c4.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.py10
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