Python's subprocess module

The subprocess module gives the developer the ability to start processes or programs from Python. In other words, you can start applications and pass arguments to them using the subprocess module. The subprocess module was added way back in Python 2.4 to replace the os modules set of os.popen, os.spawn and os.system calls as well as replace popen2 and the old commands module. We will be looking at the following aspects of the subprocess module:

  • the call function
  • the Popen class
  • how to communicate with a spawned process

Let’s get started!

Get hands-on with 1200+ tech skills courses.