Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue3235] Improve subprocess module usage

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jun 29, 2008, 2:26 AM

Post #1 of 7 (170 views)
Permalink
[issue3235] Improve subprocess module usage

New submission from Martin Mokrejs <mmokrejs[at]users.sourceforge.net>:

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.

----------
assignee: georg.brandl
components: Documentation
messages: 68943
nosy: georg.brandl, mmokrejs
severity: normal
status: open
title: Improve subprocess module usage
type: resource usage
versions: Python 2.5

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jun 29, 2008, 3:10 AM

Post #2 of 7 (165 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

Martin Mokrejs <mmokrejs[at]users.sourceforge.net> added the comment:

Please link to http://www.python.org/dev/peps/pep-0324/ from the docs
webpage at least.

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jun 29, 2008, 10:16 AM

Post #3 of 7 (161 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

David <dwblas[at]gmail.com> added the comment:

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.

----------
nosy: +dwblas

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jun 29, 2008, 10:29 AM

Post #4 of 7 (157 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

Martin v. Löwis <martin[at]v.loewis.de> added the comment:

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.

----------
nosy: +loewis

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 1, 2008, 1:00 PM

Post #5 of 7 (147 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

Georg Brandl <georg[at]python.org> added the comment:

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.

----------
resolution: -> fixed
status: open -> closed

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 2, 2008, 12:39 PM

Post #6 of 7 (142 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

Martin Mokrejs <mmokrejs[at]users.sourceforge.net> added the comment:

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 msg68956. ;-) 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.

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 5, 2008, 9:39 AM

Post #7 of 7 (135 views)
Permalink
[issue3235] Improve subprocess module usage [In reply to]

Georg Brandl <georg[at]python.org> added the comment:

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.

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue3235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.