From 508e891537201fb4da515f9668157850b752df02 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sat, 6 Jul 2013 14:40:29 +0200 Subject: [PATCH] Added a terminal width fallback --- scripts/download_import_cldr.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index da4c1efb..b60a0e40 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -16,12 +16,15 @@ BLKSIZE = 131072 def get_terminal_width(): - import fcntl - import termios - import struct - fd = sys.stdin.fileno() - cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) - return cr[1] + try: + import fcntl + import termios + import struct + fd = sys.stdin.fileno() + cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) + return cr[1] + except Exception: + return 80 def reporthook(block_count, block_size, total_size): -- 2.47.2