You’ve completed your journey into the Python subprocess
module. You should now be able to decide whether subprocess
is a good fit for your problem. You should also be able to decide whether you need to invoke the shell. Aside from that, you should be able to run subprocesses and interact with their inputs and outputs.
You should also be able to start exploring the possibilities of process manipulation with the Popen()
constructor.
Along the way, you’ve:
- Learned about processes in general
- Practiced the usage of
subprocess
- Understood how to raise and handle errors when using
run()
- Explored the use cases for
subprocess
through practical examples - Understood the standard I/O streams and how to interact with them
- Come to grips with pipes, both in the shell and with
subprocess
- Looked at the
Popen()
constructor and used it for some advanced process communication
More Real Python resources to explore:
- The subprocess Module: Wrapping Programs With Python
- Single and Double Underscore Naming Conventions in Python
- Async IO in Python: A Complete Walkthrough
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.