Exeucte a system command in python script

ken.carlino at gmail.com ken.carlino at gmail.com
Thu Jun 8 22:40:17 EDT 2006


I am using python 2.4, so I don' t need to insteall that module
separately.

ken.carlino at gmail.com wrote:
> Thanks I get this error 'NameError: global name 'call' is not defined"
>
> I already import 'subprocess'.
>
> Can you pleaes tell me what am I missing?
>
> Robert Kern wrote:
> > 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