aboutsummaryrefslogtreecommitdiffstats
path: root/tabletext.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-08-13 17:42:16 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2014-08-13 17:42:16 -0400
commit3e278b04aee135abb755c7004f51ae2b8b8b29e0 (patch)
treeeb0688df91c223eeefa5bdc8fda7ca157281cb8b /tabletext.py
parenta271fd274f497980f02a63c43b994611401656a4 (diff)
downloadtabletext-3e278b04aee135abb755c7004f51ae2b8b8b29e0.tar.gz
Fix python3 incompatibility
Diffstat (limited to 'tabletext.py')
-rw-r--r--tabletext.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tabletext.py b/tabletext.py
index 75ead70..c1fd2a5 100644
--- a/tabletext.py
+++ b/tabletext.py
@@ -79,7 +79,8 @@ def add_width(format_string, width):
def print_table(table, formats=None, padding=(1, 1), corners="┌┬┐├┼┤└┴┘",
header_corners="╒╤╕╞╪╡", header_hor="═", header_ver="│",
header=False, hor="─", ver="│"):
- sys.stdout = getwriter('utf8')(sys.stdout)
+ if sys.version < '3':
+ sys.stdout = getwriter('utf8')(sys.stdout)
n_columns = max(len(row) for row in table)
if not formats:
formats = [""] * n_columns