diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 14:40:29 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 14:40:29 +0200 |
commit | 508e891537201fb4da515f9668157850b752df02 (patch) | |
tree | b1be69db90191c4162ec7dafb929ff425e025e2a /scripts/download_import_cldr.py | |
parent | 094a9927d8ef837eebfd096d88380c45e24e6f06 (diff) | |
download | babel-508e891537201fb4da515f9668157850b752df02.tar.gz |
Added a terminal width fallback
Diffstat (limited to 'scripts/download_import_cldr.py')
-rwxr-xr-x | scripts/download_import_cldr.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index da4c1ef..b60a0e4 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): |