User Tools

Site Tools


doc:appunti:prog:python_program_execution

This is an old revision of the document!


Program execution from Python

The right module to use is subprocess. Older modules and functions that should be avoided are:

  • os.system
  • os.spawn*
  • os.popen*
  • popen2.*
  • commands.*

Run command with arguments. Wait for command to complete, then return the returncode attribute.

retcode = subprocess.call(["ls", "-l"])
doc/appunti/prog/python_program_execution.1254403855.txt.gz · Last modified: 2009/10/01 15:30 by niccolo