tag:blogger.com,1999:blog-27854051.post5150672990938075550..comments2024-03-21T18:51:18.504+02:00Comments on PythonWise: Computer Load - The AJAX WayMiki Tebekahttp://www.blogger.com/profile/03296782049507092947noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-27854051.post-12092658456766533582008-07-11T17:39:00.000+03:002008-07-11T17:39:00.000+03:00Of course the top output and command line switches...Of course the top output and command line switches had to be different in OS X and Linux.<BR/><BR/>I'll fix it to use the 'uptime' command which has the same usage and a slightly different output.<BR/><BR/>Thanks!Miki Tebekahttps://www.blogger.com/profile/03296782049507092947noreply@blogger.comtag:blogger.com,1999:blog-27854051.post-9023865564858742272008-07-11T12:10:00.000+03:002008-07-11T12:10:00.000+03:00on my linux (ubuntu) I replaced the load function ...on my linux (ubuntu) I replaced the load function by this one:<BR/><BR/>def load():<BR/> top = popen("uptime").read()<BR/> match = re.search("load average:\s+(\d+\.\d+)", top)<BR/> return float(match.groups()[0]) * 100Maxime Biaishttps://www.blogger.com/profile/08237211267641612754noreply@blogger.comtag:blogger.com,1999:blog-27854051.post-5059418268019034442008-07-11T11:58:00.000+03:002008-07-11T11:58:00.000+03:00---------------------------------------- to...----------------------------------------<BR/> top: unknown argument 'l'<BR/>usage: top -hv | -bcisSH -d delay -n iterations [-u user | -U user] -p pid [,pid ...]<BR/><BR/>----------------------------------------<BR/>Exception happened during processing of request from ('127.0.0.1', 33963)<BR/>Traceback (most recent call last):<BR/> File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request<BR/> self.process_request(request, client_address)<BR/> File "/usr/lib/python2.5/SocketServer.py", line 241, in process_request<BR/> self.finish_request(request, client_address)<BR/> File "/usr/lib/python2.5/SocketServer.py", line 254, in finish_request<BR/> self.RequestHandlerClass(request, client_address, self)<BR/> File "/usr/lib/python2.5/SocketServer.py", line 522, in __init__<BR/> self.handle()<BR/> File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle<BR/> self.handle_one_request()<BR/> File "/usr/lib/python2.5/BaseHTTPServer.py", line 310, in handle_one_request<BR/> method()<BR/> File "computer_load.py", line 71, in do_GET<BR/> self.wfile.write("%.2f" % load())<BR/> File "computer_load.py", line 13, in load<BR/> return float(match.groups()[0]) * 100<BR/>AttributeError: 'NoneType' object has no attribute 'groups'Anonymousnoreply@blogger.com