summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-02-26 04:46:53 (GMT)
committerBarry Warsaw <barry@python.org>2001-02-26 04:46:53 (GMT)
commit75ee8f54fac7cdc38e70541f2857e60fae675a70 (patch)
treea45b570de20c247dd4824f8d45c55cf74f7d1651 /Tools
parent68d486c8f4aab39b9453e27ec4d641dafb47ef7d (diff)
downloadcpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.zip
cpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.tar.gz
cpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.tar.bz2
main(): Slightly more informative error message when TokenError
occurs. Also, continue processing.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/i18n/pygettext.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py
index 834ba48..a839799 100755
--- a/Tools/i18n/pygettext.py
+++ b/Tools/i18n/pygettext.py
@@ -464,7 +464,11 @@ def main():
closep = 1
try:
eater.set_filename(filename)
- tokenize.tokenize(fp.readline, eater)
+ try:
+ tokenize.tokenize(fp.readline, eater)
+ except tokenize.TokenError, e:
+ sys.stderr.write('%s: %s, line %d, column %d\n' %
+ (e[0], filename, e[1][0], e[1][1]))
finally:
if closep:
fp.close()