There are many ways to set output buffering in Python: Disable output buffering
What am I curious about since I know that output buffering is really really already disabled? What is the best and easiest way to test this?
Try the following: $ python myscript.py | cat
$ python myscript.py | cat
If it is not loaded, the output from your script will immediately display on your terminal. Otherwise, it will be buffered with catuntil a crash occurs that is called by your script or upon completion.
cat
, , python stdout:
import sys def is_stdout_buffered(): # Print a single space + carriage return but no new-line (should have no visible effect) print " \r", # If the file position is a positive integer then stdout is buffered try: pos = sys.stdout.tell() if pos > 0: return True except IOError: # In some terminals tell() throws IOError if stdout is unbuffered pass return False
Windows CMD, MinGW Git Bash. Git Bash, , python -u, (Cmd Git Bash Python)
python -u
, , , . , .
Source: https://habr.com/ru/post/1653361/More articles:How to make the right margin double the left margin - htmlIs it possible to run Ubuntu terminal commands using DJango - pythonHow to run django runerver over TLS 1.2 - pythonВперед Объявление класса как шаблон param. Почему это работает? - c++Javascript file is not called after loading content using jquery - jqueryPython CGI os.system causes invalid header - pythonnoexcept (false) Does the destructor override the exception specification of all special members? - c ++эквивалентно устаревшему compileComponentAsync для загрузки динамических компонентов - angularDDD: Is it possible to generate / update object classes due to changes in the database schema? - c #Any way to see php POST data from external sources? - ajaxAll Articles