Martin Panter added the comment:

How about:

try:
    size = os.get_terminal_size(sys.__stdout__.fileno())
except (AttributeError, ValueError, OSError):
    # stdout is None, closed, detached, or not a terminal, or
    # os.get_terminal_size() is unsupported
    size = os.terminal_size(fallback)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26801>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to