main(): Slightly more informative error message when TokenError

occurs.  Also, continue processing.
This commit is contained in:
Barry Warsaw 2001-02-26 04:46:53 +00:00
parent 68d486c8f4
commit 75ee8f54fa
1 changed files with 5 additions and 1 deletions

View File

@ -464,7 +464,11 @@ def main():
closep = 1
try:
eater.set_filename(filename)
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()