From: Armin Ronacher Date: Sat, 6 Jul 2013 12:40:29 +0000 (+0200) Subject: Added a terminal width fallback X-Git-Tag: 1.0~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=508e891537201fb4da515f9668157850b752df02;p=thirdparty%2Fbabel.git Added a terminal width fallback --- 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):