progressiterator.py: read tty width in python