diff options
author | Barry Warsaw <barry@python.org> | 2001-02-26 04:46:53 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-02-26 04:46:53 (GMT) |
commit | 75ee8f54fac7cdc38e70541f2857e60fae675a70 (patch) | |
tree | a45b570de20c247dd4824f8d45c55cf74f7d1651 | |
parent | 68d486c8f4aab39b9453e27ec4d641dafb47ef7d (diff) | |
download | cpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.zip cpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.tar.gz cpython-75ee8f54fac7cdc38e70541f2857e60fae675a70.tar.bz2 |
main(): Slightly more informative error message when TokenError
occurs. Also, continue processing.
-rwxr-xr-x | Tools/i18n/pygettext.py | 6 |
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() |