On Mon, Sep 20, 2010 at 11:35 AM, yurkao <[email protected]> wrote: > i've ported my simple django application (v0.96 on Ubuntu hardy 8.04) > from mod_python to mod_wsgi. > the application seems to be simple enough. > On each Http user request it runs sequentaly external system commands: > * ps aux > * cat /proc/<pid>/maps > and writes their output to same output file. > > however, the result output file holds only ps aux call output, and not > the both. > Any ideas how to correctly implement that with mod_wsgi? >
Why not read the command output directly from the subprocess rather than from the webserver log? p = subprocess.Popen(...other args..., stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout,stderr = p.communicate() stdout_content = stdout.read() # stdout is a file-like object stderr_content = stderr.read() if you want stderr to be combined in a single pipe with stdout, use stderr=subprocess.STDOUT in your Popen() arguments. Rob :) Rob :) -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
