Message400561
If you run subprocess.run(capture_output=True), it doesn't show output, but if you run subprocess.run(capture_output=False) (or if you just run subprocess.run() since False is default), it does show output. In the example in the docs, it shows this in the examples section:
```py
>>> subprocess.run(["ls", "-l"]) # doesn't capture output
CompletedProcess(args=['ls', '-l'], returncode=0)
>>> subprocess.run(["ls", "-l", "/dev/null"], capture_output=True)
CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,
stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\n', stderr=b'')
```
This clearly shows capture_output showing output if true but not if false. Test code:
```py
import subprocess
subprocess.run("dir", shell=True, capture_output=False)
subprocess.run("dir", shell=True, capture_output=False)
```
Other notes: for some reason I get an error if I don't add shell=True, so maybe that contributes? I am on Windows 10 if that matters. |
|
Date |
User |
Action |
Args |
2021-08-29 21:12:54 | deleted-user-7BsjxvvFYDdTwO8F | set | recipients:
+ deleted-user-7BsjxvvFYDdTwO8F |
2021-08-29 21:12:54 | deleted-user-7BsjxvvFYDdTwO8F | set | messageid: <1630271574.19.0.912939412698.issue45048@roundup.psfhosted.org> |
2021-08-29 21:12:54 | deleted-user-7BsjxvvFYDdTwO8F | link | issue45048 messages |
2021-08-29 21:12:54 | deleted-user-7BsjxvvFYDdTwO8F | create | |
|