I have an executable that I need to run which outputs messages to the stdout while running, however when using subprocess, it seems to wait for the script to finish completely before sending the messages.
Note: Using Windows 10
The executable that I will need to run is not a Python process, so it can not be fixed by adding sys.stdout.flush(), python -u ... etc.
main.py
import subprocess
popen = subprocess.Popen(["my_process"], stdout=subprocess.PIPE, universal_newlines=True)
for line in popen.stdout:
print(line)
Anyone have any ideas how I can fix this? I am planning to implement this in a PyQt gui using QProcess, though the problem is also present in that implementation.
-uusing env variable