This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author CristianCantoro
Recipients CristianCantoro, r.david.murray
Date 2014-08-27.14:45:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409150757.6.0.716144045125.issue22277@psf.upfronthosting.co.za>
In-reply-to
Content
Hi David,

*now* I understand your point (!) and, yes, this is something I have thought about.

Basically, I was thinking that with this addition I wanted an easy way to suppress stdout/stderr output. I have thought about simply exposing subprocess.Popen's stderr and stdout parameters (i.e. passing stdout and stdout to subprocess.Popen as they are) but this would have meant that to suppress the output one should do the following:

```
import webbrowser
import subprocess

webbrowser.open('http://www.example.com', stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
```

This seems to be utterly complicated to me, also I don't like to have to import the subprocess module just to make use of subprocess.DEVNULL. (an alternative would be passing file(os.devnull, "r+") à la Python 2.7, but the problem of needing an additional module remains). 
Also, I find that *in the context of the webbrowser module* using subprocess.Popen semantics i.e.:
```
webbrowser.open('http://www.example.com', stdout=None, stderr=None)
```
to mean that the stderr and stdout file descriptors are inherited from the parent process is quite counter-intuitive.

That's why I have changed the semantics of the parameters the way I did.

A couple of possible alternatives were changing the name of the parameters:
1) suppress_stdout/suppress_stderr. In this case True (which is not a valid value for subprocess.Popen parameters) would suppress stdout/stderr and None would be meaningful to say 'inherit from parent process'. In this way this would be an addition to subprocess.Popen semantic, but it would be counter-intuitive to the possibility of redirecting to, say, another file.
2) redirect_stdout/redirect_stderr. Actually this was my first thinking when implementing this, but it has the same problems, IMHO, of the plain stdout/stderr and in the end this is why I chose the latter.

Does this make sense?

Cristian
History
Date User Action Args
2014-08-27 14:45:57CristianCantorosetrecipients: + CristianCantoro, r.david.murray
2014-08-27 14:45:57CristianCantorosetmessageid: <1409150757.6.0.716144045125.issue22277@psf.upfronthosting.co.za>
2014-08-27 14:45:57CristianCantorolinkissue22277 messages
2014-08-27 14:45:57CristianCantorocreate