calling command line programs?


G

Grant Edwards

This is probably a very newbie question, but after searching
google and docs @ python.org I can't find an answer, so maybe
someone would be able to help?

I'd like to call command-line functions from my python script
(like you would in perl using backticks)... Is there a way of
doing this? And if so, how does the environment get treated (I
have some variables in my env that the programs I'd be calling
need to see).

Take a look at os.popen, os.spawn, or the popen2, and
subprocess modules.

That last one seems to be gaining popularity.
 
Ad

Advertisements

C

chriss

Grant said:
Take a look at os.popen, os.spawn, or the popen2, and
subprocess modules.

That last one seems to be gaining popularity.

The suggested modules and functions have been deprecated according to the
python 2.4 docs. The doc suggests to use the functions in the 'subprocess'
module.

chriss
 
Y

Yevgeniy (Eugene) Medynskiy

Hi all,

This is probably a very newbie question, but after searching google and
docs @ python.org I can't find an answer, so maybe someone would be able
to help?

I'd like to call command-line functions from my python script (like you
would in perl using backticks)... Is there a way of doing this? And if
so, how does the environment get treated (I have some variables in my
env that the programs I'd be calling need to see).

Thanks much!
Eugene
 
G

Grant Edwards

The suggested modules and functions have been deprecated according to the
python 2.4 docs. The doc suggests to use the functions in the 'subprocess'
module.

The subprocess module is depricated?
 
Ad

Advertisements

D

Dennis Lee Bieber

no, the subrocess module intends to replace modules and functions such as:

I think the nit was that the subprocess module HAD been mentioned in
the same sentence (look above the first <snip>) and was not explicitly
excluded from the other modules in the deprecation statement (second
<snip>).

An immediate parse of the sentences, therefore, would conclude that
subprocess IS also deprecated.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top