From 847e5a14d6d7991682c3add853f7b3cc32f935df Mon Sep 17 00:00:00 2001 From: Celelibi Date: Mon, 3 Apr 2023 05:22:12 +0200 Subject: python: add flush() to Stdout Python sometime calls flush() on sys.stdout or sys.stderr. In particular, it might do so when an exception is raised. This fixes the second error message that was generated in such cases. Signed-off-by: Celelibi --- plugins/python/python.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins') diff --git a/plugins/python/python.py b/plugins/python/python.py index 7a794784..07900eb2 100644 --- a/plugins/python/python.py +++ b/plugins/python/python.py @@ -64,6 +64,10 @@ class Stdout: else: self.buffer += string + def flush(self): + lib.hexchat_print(lib.ph, bytes(self.buffer)) + self.buffer = bytearray() + def isatty(self): return False -- cgit 1.4.1