[Tutor] XP & catching execl o/p ?

Luke Paireepinart rabidpoobear at gmail.com
Tue Dec 5 21:58:39 CET 2006


Dave S wrote:
> Hi all,
>
> Struggling with python & XP again. My app needs to know if a certain program 
> is running on my XP box
>
> Ideal world - I can get the output of 'tasklist.exe' into a string.
>
> I have tried
>
> os.execl('....')
> It throws the output to the terminal + I need the exact path to the executable 
> (a bit of a trial)
>
> and
> os.startfile('...') 
> it throws the output to a different window, but no exact path needed
>
> Any ideas how I can catch the output ?
>   
You could try redirecting sys.stdout to a file-like class instance you 
create.
> Cheers
>
> Dave
>
>  
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   



More information about the Tutor mailing list