Re: Question
On Saturday 19 July 2008 03:14:20 pm Peter Otten wrote: > [EMAIL PROTECTED] wrote: > > Why is Perl so much better than python? > > Because you have the video: > > http://mail.python.org/pipermail/python-list/2004-March/253370.html >> what about this ? i feel python's better :) >> http://www.monstersandcritics.com/people/news/article_1339060.php > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you check if a program/process is running using python?
On Sunday 20 July 2008 12:08:49 am Lamonte Harris wrote: > How do you check if a program or process is running when using python? > What I want to do is have an infinite loop to check if a program is running > or not and send data to my web server to check yes or no. Is this > possible? If so how? you can execute OS system call. here i execute ps -ef and grep the required process name (or you can grep by pid on that particular column using awk) import os os.system("ps -ef | grep -v grep | grep ") in my system it gives result 0 if the process is running >>> a = os.system("ps -ef | grep -v grep | grep python") root 8749 5331 0 Jul19 pts/100:00:00 python >>> a 0 else gives non 0 : >>> a = os.system("ps -ef | grep -v grep | grep python123") >>> a 256 you can check this inside while True: I am sure there should be a far better solution that this in python. -Venky -- http://mail.python.org/mailman/listinfo/python-list