From a44f9f6c9032aa5cbff35311db140245d9120082 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 23 Aug 2018 14:25:41 +0100 Subject: [PATCH] Fix chunk() output when given zero-length data --- tv_output.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tv_output.py b/tv_output.py index ce63ad8..fcb225d 100644 --- a/tv_output.py +++ b/tv_output.py @@ -8,7 +8,8 @@ import json def chunk(h): hstr = str(h, 'utf-8') - return '0x' + ', 0x'.join([hstr[i:i+2] for i in range(0, len(hstr), 2)]) + hstr = ', 0x'.join([hstr[i:i+2] for i in range(0, len(hstr), 2)]) + return '0x' + hstr if hstr else '' class Some(object): def __init__(self, thing):