From 9c98db83f4a907d85e5b29404bc50df0e4a2dc66 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 27 Sep 2016 00:50:29 +0300 Subject: [PATCH] Fix a bug: assign buffer even if encoding is None --- sqlconvert/print_tokens.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlconvert/print_tokens.py b/sqlconvert/print_tokens.py index a0a4f8b..6aa6fb4 100644 --- a/sqlconvert/print_tokens.py +++ b/sqlconvert/print_tokens.py @@ -5,6 +5,8 @@ import sys def print_tokens(token_list, outfile=sys.stdout, encoding=None): if encoding: buffer = getattr(outfile, 'buffer', outfile) + else: + buffer = outfile for token in token_list.flatten(): normalized = token.normalized if encoding: -- 2.39.2