TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: DENNIS LEE BIEBER
from: =?UTF-8?Q?BJ=C3=B6RN_LUND
date: 2017-10-23 10:13:00
subject: Re: Screen control

On 2017-10-22 21:50, Dennis Lee Bieber wrote:


>   sys.stdout.flush()


instead of flushing every time you could:
# reopen stdout file descriptor with write mode
# and 0 as the buffer size (unbuffered)
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

see https://stackoverflow.com/questions/107705/disable-output-buffering

There seems to be other ways too, like passing -u to the interpreter
or setting env var  PYTHONUNBUFFERED

These two last I did not test, but some years ago I did reopneh stdout
with 0 buffer and it worked fine (on python 2.7 at least)




--
--
Björn

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.