From 4a471d39b11d5b9188823f7962326aaf04262cb9 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 18 Sep 2015 00:02:31 -0400 Subject: [PATCH] fix error handler not displaying errors on startup --- src/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index 5a7c387..cd423e2 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -131,7 +131,6 @@ class ErrorHandler(io.TextIOWrapper): self.data = None def write(self, data): - assert not (self.cli is None or self.target_logger is None) if self.closed: raise ValueError("write to closed file") if not isinstance(data, str): @@ -144,6 +143,11 @@ class ErrorHandler(io.TextIOWrapper): return length def flush(self): + # Probably a syntax error on startup, so these aren't defined yet + # If we do nothing, the error magically is printed to the console + if self.cli is None or self.target_logger is None: + return + self.buffer.flush() if self.data is None: