You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: subprocess/README.md
+1-77Lines changed: 1 addition & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,80 +4,4 @@ Here are supporting materials for the Real Python tutorial [The `subprocess` Mod
4
4
5
5
Be aware that some examples are designed for particular operating systems. The `basics_unix.py` file won't work on Windows, for instance.
6
6
7
-
Below, you'll find quick descriptions of what the different scripts do.
8
-
9
-
## [basics_unix.py](basics_unix.py)
10
-
11
-
**Only works on Linux or macOS**
12
-
13
-
Demonstrates basic usage of `subprocess.run()`.
14
-
15
-
## [basics_win.py](basics_win.py)
16
-
17
-
**Only works on Windows**
18
-
19
-
Demonstrates basic usage of `subprocess.run()`.
20
-
21
-
## [custom_exit.py](custom_exit.py)
22
-
23
-
Raises custom exit codes:
24
-
25
-
```shell
26
-
$ python custom_exit.py 3
27
-
```
28
-
29
-
This will exit with error code `3`. By default, will exit with code `0`.
30
-
31
-
## [exiter_run.py](exiter_run.py)
32
-
33
-
Calls [custom_exit.py](custom_exit.py) with `subprocess.run()`, demonstrating the `check` argument to `.run()`.
34
-
35
-
## [error_handling.py](error_handling.py)
36
-
37
-
Demonstrates error handling with `subprocess.run()`, catching common errors that `subprocess.run()` can encounter. Try changing the commands in `subprocess.run()` to raise different errors.
38
-
39
-
## [timer.py](timer.py)
40
-
41
-
Accepts an integer argument and will sleep for the given time. For example:
42
-
43
-
```
44
-
$ python timer.py 5
45
-
Starting timer of 5 seconds
46
-
.....Done!
47
-
```
48
-
49
-
## [popen_pipe.py](popen_pipe.py)
50
-
51
-
**Only works on Linux or macOS**
52
-
53
-
Demonstrates using `subprocess.Popen()` to pipe one command into the other.
0 commit comments