Grant Edwards wrote: os.environ["COLUMNS"]
> [...] will tell you the terminal size at the time Python was started. I admit that none of my scripts is ambitious enough to try and track changes in terminal size. But still, Grant's post prompted me to reread the doc and source of shutil.get_terminal_size(), and I think I should warn you that the environment variables take precedence over ioctl()-based detection in os.get_terminal_size(). I'll keep the exports for now because even for a pipe $ python3 -c 'import shutil; print(shutil.get_terminal_size())' | cat os.terminal_size(columns=80, lines=24) $ export LINES COLUMNS $ python3 -c 'import shutil; print(shutil.get_terminal_size())' | cat os.terminal_size(columns=137, lines=42) the current terminal is usually my final target. -- https://mail.python.org/mailman/listinfo/python-list