[Tutor] os.system

alan.gauld@bt.com alan.gauld@bt.com
Mon, 19 Nov 2001 00:00:38 -0000


> pid = os.fork()
> if pid == 0 :
>     # this is the child
>     os.execv( "xv" , ( "-display" , "host:0.0" , "picture.jpg" ) )
> else :
>     # this is the parent,
>     # nothing special to do
>     pass

Rather than pass I guess he should really sleep then run 
kill on pid. This is better than using ps to get the pid 
as I suggested earlier. But how to kill the xv remains. Unless 
he's happy to leave xv up until the python program closes 
in which case ISTR the child process gets bumped too 
- which is probably what you had in mind, whereas I was 
assuming he wanted to kill it sooner...

Hmm, I think I just showed the inner meanderings of my mind!
Its getting late.
:-)

Alan g