Exeucte a system command in python script

Robert Kern robert.kern at gmail.com
Fri Jun 9 03:25:10 CEST 2006


ken.carlino at gmail.com wrote:
> Hi,
> 
> I would like to execute a shell command like this in python:
> cmd = 'ant release -Dbuild=build_proxyonly -Drev=5.1.130f
> -Dprops=\"-MIDP20_LARGE;PUSH_FEATURE=false;MIDlet-Version=5.0;version=5.0;MIDlet-Icon=midicon15x15.png;-FOUR_WAY_NAV_FEATURE\"
> -DThree_Branding=true'
> 
> Which of the execl command described here should I use?
> http://pydoc.org/1.6/os.html

None. You should use the subprocess module in 2.4 (I really do hope that you're
not using 1.6).

  http://docs.python.org/lib/module-subprocess.html

It also works in Pythons as old as 2.2, but you'll have to install it
separately. The website for the separate release is down at the moment, but when
it comes back up:

  http://www.lysator.liu.se/~astrand/popen5/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list