Re: [Python-Dev] Fwd: subprocess.Popen(.... stdout=IGNORE, ...)

On Tue, 13 Jun 2006, Martin Blais wrote: Hi all. Now let's see if I remember something about my module...
Yes, the call convenience function is basically for the case when you are not interested in redirection.
Yes, this is a common case, and using communicate() is indeed overkill and wasteful.
Yes, this works. You can also do: returncode = subprocess.call(command, stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT)
I have a vague feeling of that this has been discussed before, but I cannot find a tracker for this. I guess an IGNORE constant would be nice. Using open('/dev/null', 'w') is only a few more characters to type, but as you say, it's not platform independent. So, feel free to submit a patch or a Feature Request Tracker.
How do you suggest the call() should be modified? I'm not really sure it can do more without being more complicated. Being simple is the main purpose of call().
Yes, as Terry Reedy points out, NUL: can be used. Regards, /Peter Åstrand <astrand@lysator.liu.se>

There is a related bit of functionality for subprocess that would allow for asynchronous handling of IO to/from the called subprocess. It has been implemented as a recipe [1], but requires the use of additional pywin32 functionality on Windows. As was the case for the original subprocess module, in order to get the proper functionality on Windows, we may need to include additional features from pywin32 into the _subprocess.c driver, or alternatively, convert all _subprocess.c bits into ctypes calls. If the inclusion of additional code into _subprocess.c or the use of ctypes is undesireable, this feature could require the *user* to install pywin32 on Windows, which would be unfortunate, but perfectly reasonable. With an asynchronous handler for the subprocess module, a user could ignore or process output from a subprocess as desired or necessary. - Josiah [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 Peter Astrand <astrand@lysator.liu.se> wrote:

There is a related bit of functionality for subprocess that would allow for asynchronous handling of IO to/from the called subprocess. It has been implemented as a recipe [1], but requires the use of additional pywin32 functionality on Windows. As was the case for the original subprocess module, in order to get the proper functionality on Windows, we may need to include additional features from pywin32 into the _subprocess.c driver, or alternatively, convert all _subprocess.c bits into ctypes calls. If the inclusion of additional code into _subprocess.c or the use of ctypes is undesireable, this feature could require the *user* to install pywin32 on Windows, which would be unfortunate, but perfectly reasonable. With an asynchronous handler for the subprocess module, a user could ignore or process output from a subprocess as desired or necessary. - Josiah [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 Peter Astrand <astrand@lysator.liu.se> wrote:
participants (2)
-
Josiah Carlson
-
Peter Astrand