[issue29609] Receiving messages from subprocess does not work on Mac OS X
New submission from pyguy: When I use the subprocess module to run a another process, I expect to be able to read the STDOUT and STDERR of the other process. This is not possible on Mac OS X. The attached test program has been tested on Linux and Windows and does work as expected. It pauses at the process.stdout.readline() line of code every time on Mac OS X. -- components: macOS files: testwrapper.py messages: 288250 nosy: ned.deily, pyguy, ronaldoussoren priority: normal severity: normal status: open title: Receiving messages from subprocess does not work on Mac OS X type: behavior versions: Python 2.7, Python 3.5 Added file: http://bugs.python.org/file46656/testwrapper.py ___ Python tracker <http://bugs.python.org/issue29609> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29609] Receiving messages from subprocess does not work on Mac OS X
pyguy added the comment: The program failed for me on Mac OS 10.4.11 using Python 2.7.12 and Mac OS 10.6.8 using Python 2.7.13. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue29609> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29609] Receiving messages from subprocess does not work on Mac OS X
pyguy added the comment: Using communicate fixed the problem. Here is the program that works for me on Mac OS 10.4.11 with Python 2.7.12: import subprocess import time print("Launch started") program_name = "top" list = [program_name] process = subprocess.Popen(list) while process.poll() == None: print("subprocess still running") print("Value = " + process.communicate()) time.sleep(0.1) print("Exit") Thank you Ned. -- resolution: works for me -> fixed ___ Python tracker <http://bugs.python.org/issue29609> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29609] Receiving messages from subprocess does not work on Mac OS X
pyguy added the comment: The program does not work the way I wanted it to. I want the output of the top command to be seen only by the python program. The program I made causes the top command to print its output to the terminal. Using subprocess.Popen() with stdout=subprocess.PIPE does prevent the top command's output from being printed to the terminal. Now I need a way to actually work with that output. Would you know a way to do this? I can't use the communicate() function because it blocks until the top command quits. -- resolution: not a bug -> works for me status: closed -> open ___ Python tracker <http://bugs.python.org/issue29609> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com