msg68943 - (view) |
Author: Martin Mokrejs (mmokrejs) |
Date: 2008-06-29 09:26 |
Although I do appreciate that you try to improve python it is not clear to me from http://docs.python.org/lib/module-subprocess.html: 1. Why the old functions have been deprecated 2. I can pipe together two processes. But how can I use pipe to feed the first process of the two? The example at http://docs.python.org/lib/node535.html is not sufficient. Show how to bind together cat(1) and tr(1). Cat should read from STDIN and pass the same to STDOUT, being read by tr(1). 3. Nowhere is explained what this magic really does: output = p2.communicate()[0] I figured out the result is e.g. a string of '\n' separated lines. What is not clear whether at this very moment the processes get started and whether one can still write on input to them. It seems not, the p1.stdin has to be already populated with data. Thanks. |
|
|
msg68944 - (view) |
Author: Martin Mokrejs (mmokrejs) |
Date: 2008-06-29 10:10 |
Please link to http://www.python.org/dev/peps/pep-0324/ from the docs webpage at least. |
|
|
msg68956 - (view) |
Author: David (dwblas) |
Date: 2008-06-29 17:16 |
See if Doug Hellman's module of the week helps any http://blog.doughellmann.com/2007/07/pymotw-subprocess.html I plan on asking him if we can include some of his examples in the Python 3000 docs. Subprocess is new enough and gets enough questions on the forums that I think we should be as detailed as possible and include more examples than there are in other doc/tools examples. |
|
|
msg68959 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2008-06-29 17:29 |
1. The documentation never gives a rationale for deprecating things. To find out why they are deprecated, you'll typically have to research what checkins to a code base have been made that added the deprecation, and perhaps also ask on mailing lists. For the regular developer, the rationale for deprecation should be irrelevant, as he needs to change his code to drop usage of the deprecated API, anyway. 2. You really need to read all of the documentation, in particular the section that talks about stdin,stdout,stderr in http://docs.python.org/lib/node528.html In the example, stdin is inherited from the parent process. Read the documentation to find out how to send data to the first process. 3. It is not true that this is nowhere explained. http://docs.python.org/lib/node532.html explains precisely what the semantics of communicate is. |
|
|
msg69062 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2008-07-01 20:00 |
Added a link to PEP 324 in r64625. The other issues were explained by Martin; it will be easier to read the subprocess docs in 2.6 where they're all on one page. |
|
|
msg69111 - (view) |
Author: Martin Mokrejs (mmokrejs) |
Date: 2008-07-02 19:39 |
Georg, but would you please improve the docs explaining what communicate really does? The syntax is nice but I don't see how can I use poll() described in the same above to use that. Providing Examples section would be the best. Of course I don't mind if the examples come from Doug Hellman or not, as mentioned in . ;-) Or how about placing a link to that page (http://blog.doughellmann.com/2007/07/pymotw-subprocess.html)? Please reopen unless better docs are available. I don't care about 2.6 either, sorry. |
|
|
msg69284 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2008-07-05 16:39 |
I don't understand the comment about poll(). In any case, I plan on referencing Doug's PyMOTW pages for all modules he does, since they are indeed excellent tutorials. |
|
|