samedi 27 juin 2015

refresh a shell subprocess in python

I have a webpy code that sends "ps aux" data to a webpage using a subprocess.

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)

It sends the ps aux data across no problem however it does not refresh the ps aux data so i only get 1 continuous set rather than a changing set of data i am needing.

How do i refresh the subprocess to send new data every time I reload the webpage ?

Aucun commentaire:

Enregistrer un commentaire