From 58f1b9cbad19f23a6c3177c871d99292e0222d30 Mon Sep 17 00:00:00 2001 From: Egon Valdmees Date: Wed, 1 Jun 2011 09:46:57 +0300 Subject: [PATCH] no crash when column detection fails --- python/londiste/handlers/dispatch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/londiste/handlers/dispatch.py b/python/londiste/handlers/dispatch.py index 0a9e954e..81e10d58 100644 --- a/python/londiste/handlers/dispatch.py +++ b/python/londiste/handlers/dispatch.py @@ -591,7 +591,10 @@ class EncodingValidator: raise exc # find starting position of line with error and log warning _line_start = exc.object.rfind('\n', 0, exc.start) + 1 - _col = self.columns[exc.object.count('\t', _line_start, exc.start)] + try: + _col = self.columns[exc.object.count('\t', _line_start, exc.start)] + except IndexError: + _col = '' _msg = "replacing invalid %s sequence %r in column %s"%\ (self.encoding, exc.object[exc.start:exc.end], _col) self.log.warning(_msg) -- 2.39.5