0
我有一个webpy代码,它使用子进程将“ps aux”数据发送到网页。在Python中刷新shell子进程
import subprocess
ps = subprocess.Popen(('ps', 'aux'), stdout-subprocess.PIPE)
out = ps.communicate()[0]
(bunch of webpy stuff)
class index:
def GET(self):
return (output)
(more webpy to start the web server)
它发送PS AUX数据通过没有问题但它不刷新的ps aux数据,所以我只拿到1组连续的,而不是数据的集合改变我很需要。
如何在每次重新加载网页时刷新子流程以发送新数据?
,你将不得不再次调用该函数 –
你可以[使用'psutil'得到进程信息](https://pypi.python.org/pypi/psutil)。另请参阅[如何浏览服务器和浏览器浏览器工作](https://github.com/nicolargo/glances)。 – jfs