rclpython.py: dont try to subscript an exception

This commit is contained in:
Jean-Francois Dockes 2021-03-29 09:52:38 +02:00
parent ec389f89f5
commit 7a54c3a110

View File

@ -137,14 +137,6 @@ class Parser:
try:
for a,b,c,d,e in tokenize.tokenize(text.readline):
self(a,b,c,d,e)
except tokenize.TokenError as ex:
msg = ex[0]
line = ex[1][0]
self.out.write(("<h3>ERROR: %s</h3>%s\n" % (
msg, self.raw[self.lines[line]:])).encode('utf-8'))
except IndentationError as ex:
msg = ex[0]
self.out.write(("<h3>ERROR: %s</h3>\n" % (msg)).encode('utf-8'))
except Exception as ex:
# There are other possible exceptions, for example for a
# bad encoding line (->SyntaxError). e.g. # -*- coding: lala -*-