diff --git a/extra/ansistrm/ansistrm.py b/extra/ansistrm/ansistrm.py index 9212f7c27..ce85f8058 100644 --- a/extra/ansistrm/ansistrm.py +++ b/extra/ansistrm/ansistrm.py @@ -61,7 +61,6 @@ class ColorizingStreamHandler(logging.StreamHandler): def output_colorized(self, message): self.stream.write(message) else: - import ctypes import re ansi_esc = re.compile(r'\x1b\[((?:\d+)(?:;(?:\d+))*)m') @@ -77,6 +76,8 @@ class ColorizingStreamHandler(logging.StreamHandler): } def output_colorized(self, message): + import ctypes + parts = self.ansi_esc.split(message) write = self.stream.write h = None