python / python/cpython

subprocess.run parameters not fully documented

Offen
#127,008 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

docs
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

https://docs.python.org/3/library/subprocess.html#subprocess.run

So I want to capture STDERR, but it doesn't actually say how to do that anywhere that I can see. Note that I don't want to capture STDOUT.

My IDE is telling me that stderr accepts None and Int types. What are the int values? I'm guessing a PIPE:

subprocess.PIPE
Special value that can be used as the stdin, stdout or stderr argument to Popen and indicates that a pipe to the standard stream should be opened.

Now the user also needs to understand the inner workings of Popen? Why on earth does a user need to join so many dots just to use an arguement? Is not explicit is better than implicit part of the python ethos?

I'm sorry to be blunt, but none of this is well documented. There should be a comprehensive, itemised list of all parameters. Each one should explicitly list what they do and what their possible values are. As it is, it's a confused mess of "if x, then y in module q, but not z in module p".

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der im Issue verlinkten Dokumentation zu subprocess.run und vergleiche deren Parameterbeschreibungen mit der referenzierten Popen-Dokumentation, insbesondere stderr und subprocess.PIPE. Die Aufgabe ist abgeschlossen, wenn die Parameter und akzeptierten Werte klar genug dokumentiert sind, um das Erfassen von STDERR zu erklären, ohne dass Leser das Verhalten aus einer anderen API ableiten müssen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.