a sub process problem.

Rainy sill at optonline.net
Sun May 27 17:18:16 CEST 2001


On Sun, 27 May 2001 11:40:44 +0530, Rajarshi Guha <rajarshi at presidency.com> wrote:
> i,
>   I was writing a script to search my mail archives. After doing the search
> I'd like to start Pine from the script and view the results. In addition
> after the
> exit of Pine I want the script to carry on - ie the script should wait until
> the pine process finishes. I've tried using the popen2 class but I get the
> following error:
> 
> Traceback (most recent call last):
>   File "/home/rajarshi/src/misc/py/ptest.py", line 153, in ?
>     print p.poll()
> AttributeError: 'tuple' object has no attribute 'poll'
> 
> ,where p = os.popen4("pine")
> 
> But the docs say that instances of popen2 and peopn4 have the methods poll()
> and wait().  I also tried os.spawn(os.P_WAIT,"pine") but then the the
> program just carries on and no pine comes up.
> 
> Could somebody please tell me where I'm going wrong and how I could solve
> this problem.
> 
> PS. I'm doing all this under Linux and Python 2.1
> TIA,

Wouldn't it be simpler here to just use os.system?
> 
> 
> --
> -------------------------------------------------------------
> Rajarshi Guha
> 
> email: rajarshi at presidency.com
> web: http:/www.psynet.net/jijog
> 
> 


-- 
The point of philosophy is to start with something so simple as not
to seem worth stating, and to end with something so paradoxical
that no one will believe it.



More information about the Python-list mailing list