[Tutor] os.system

alan.gauld@bt.com alan.gauld@bt.com
Tue, 20 Nov 2001 16:13:43 -0000


Fine, but using fork() as someone else suggested provides 
a neater and reliable way of getting the pid without 
resorting to ps.

Otherwise it looks Ok.

Alan g

> Thank you for the hints. What do you think about:
> 
>     def suche(self):
>         pr = os.popen("ps axw","r")
>         zeilen=pr.readlines()
>         print zeilen
>         pr.close()
>         for zeile in zeilen:
>             if string.find(zeile,self.host) >= 0 and 
> string.find(zeile,self.bild) >= 0:
>                 pid = string.split(zeile," ")[0]
>         return int(pid)