From 76b10817d9b892e9cda98344dedd54629a872388 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Sat, 7 Apr 2018 16:18:48 -0400 Subject: [PATCH] Fixing invalid null byte handling for python 2 --- rtv/terminal.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtv/terminal.py b/rtv/terminal.py index 85c507b..bfdcd47 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -275,8 +275,10 @@ class Terminal(object): text = self.clean(text, n_cols) params = [] if attr is None else [attr] window.addstr(row, col, text, *params) - except (curses.error, ValueError) as e: - # window.addstr could raise "ValueError: embedded null byte" + except (curses.error, ValueError, TypeError) as e: + # Curses handling of strings with invalid null bytes (b'\00') + # python 2: TypeError: "int,int,str" + # python 3: ValueError: "embedded null byte" _logger.warning('add_line raised an exception') _logger.exception(str(e))