classification
Title: Having a shlex example in the subprocess.Popen docs is confusing
Type: enhancement Stage: needs patch
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Julian, cvrebert, docs@python, eric.araujo, r.david.murray, sandro.tosi
Priority: low Keywords: easy

Created on 2012-01-19 14:25 by Julian, last changed 2016-04-19 00:07 by berker.peksag.

Messages (4)
msg151624 - (view) Author: Julian Berman (Julian) * Date: 2012-01-19 14:25
The example at http://docs.python.org/dev/library/subprocess.html#popen-constructor seems a bit misplaced, as it seems to suggest that one should use the shlex module. Most of the other examples in the module seem to use a list to provide the args, so if there was a need to just point out that shlex could be used for a corner case perhaps it'd be better suited as a footnote or another subsection somewhere.
msg151627 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-01-19 14:36
It is not particularly intuitive what goes in to a Popen non-shell argument list, unless you are an experienced programmer.  The real purpose of the note is to convey a lot of information about how tokenization works in a short example, and it also demonstrates how to investigate other complex cases the user may have to deal with.  Because of the first part of that (showing tokenization quirks) I don't think it should be relegated to a footnote.

That said, the example could perhaps be reworded slightly to make its expositional purpose clearer.  Suggestions welcome.
msg151631 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2012-01-19 14:45
Maybe we can add a very small example before the whole note to show just how to use Popen in simple situation, and so the shlex part below will add more details for more advanced cases.
msg151649 - (view) Author: Julian Berman (Julian) * Date: 2012-01-19 19:41
Sounds reasonable to me.

I'll take a look at adding one unless someone manages to beat me to it.
History
Date User Action Args
2016-04-19 00:07:35berker.peksagsetkeywords: + easy
stage: needs patch
versions: + Python 3.5, Python 3.6, - Python 2.7, Python 3.2, Python 3.3
2014-05-16 05:54:47cvrebertsetnosy: + cvrebert
2012-02-03 14:35:00eric.araujosetnosy: + eric.araujo
2012-01-19 19:41:57Juliansetmessages: + msg151649
2012-01-19 14:45:46sandro.tosisetnosy: + sandro.tosi

messages: + msg151631
versions: - Python 2.6, Python 3.1
2012-01-19 14:37:14r.david.murraysetpriority: normal -> low
2012-01-19 14:36:48r.david.murraysetnosy: + r.david.murray
messages: + msg151627
2012-01-19 14:25:14Juliancreate