From 5827fd8c715990a21088d1c6e7a9fe517f908486 Mon Sep 17 00:00:00 2001 From: Krzysztof Bociurko Date: Fri, 20 Oct 2017 11:55:18 +0200 Subject: [PATCH] idf_monitor: Fixed a bug where pressing a key that doesn't encode into a proper ASCII character, terminated the monitor with an exception --- tools/idf_monitor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/idf_monitor.py b/tools/idf_monitor.py index 1f315f29e3..e4a5ec4bd3 100755 --- a/tools/idf_monitor.py +++ b/tools/idf_monitor.py @@ -292,6 +292,8 @@ class Monitor(object): self.serial.write(codecs.encode(key)) except serial.SerialException: pass # this shouldn't happen, but sometimes port has closed in serial thread + except UnicodeEncodeError: + pass # this can happen if a non-ascii character was passed, ignoring def handle_serial_input(self, data): # this may need to be made more efficient, as it pushes out a byte