get the output of a cmd via popen2

Rajarshi Guha rajarshi at seed.chem.psu.edu
Sat Aug 25 20:18:17 EDT 2001


Hi,
  I think I'm doing the right thing, but it does'nt seem to be working.

I have a command which I want to run from a Python script and I want to 
capture the output. So I do,

i,o = os.popen2(cmd)

where cmd is the string that represents the command. But on printing o all 
I get is an object representation like: 

<open file '(fdopen)', mode 'r' at 0x810d9f8>

Not the output of the program.

Any suggestions as to whats going wrong and how to fix it?

TIA
-- 
--
Rajarshi Guha



More information about the Python-list mailing list