Python script writes no output when stdout is redirected to a file [duplicate] Python script writes no output when stdout is redirected to a file [duplicate] python-3.x python-3.x

Python script writes no output when stdout is redirected to a file [duplicate]


If you are using print to output text, its argument flush might help you:

print('Hello, World', flush=True)

Otherwise:

import syssys.stdout.write('Hello, world\n')sys.stdout.flush()

will have the same effect.