Python Forum
subprocess.Popen parameter bufsize issue - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: subprocess.Popen parameter bufsize issue (/thread-5780.html)



subprocess.Popen parameter bufsize issue - streetpywinder - Oct-21-2017

        args = ('D:/ProgramFiles/Python352/Scripts/pyinstaller.exe', '-w', file_full_path, '-i', ico_full_path) 
        process = subprocess.Popen(args, bufsize=1, cwd=file_path, stdout=None, stderr=subprocess.PIPE, universal_newlines=True)
        for line in process.stderr:
            print(line) 


I'm creating sublime text3 plugin,I got the same result when the parameter bufsize=0,or,1 or other int.
Something wrong?


RE: subprocess.Popen parameter bufsize issue - Larz60+ - Oct-21-2017

Quote:I got the same result
And what was the result?


RE: subprocess.Popen parameter bufsize issue - streetpywinder - Oct-21-2017

(Oct-21-2017, 10:31 AM)Larz60+ Wrote: And what was the result?
Per the Api doc,if the bufsize=1 and universal_newlines=True,means line buffered,but The output isn't available until the program completes ,it's not output by line, it seems the output is irrelevant to the 'bufsize'.


RE: subprocess.Popen parameter bufsize issue - streetpywinder - Oct-22-2017

https://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python
The answer.