multiprocessing and accessing server's stdout

Bryan bryanjugglercryptographer at yahoo.com
Wed Jun 2 16:07:01 EDT 2010


Tim Arnold wrote:
> Hi, This is the setup I was asking about.
> I've got users using a python-written command line client. They're
> requesting services from a remote server that fires a LaTeX process. I
> want them to see the stdout from the LaTeX process.

So what you really need is to capture the output of a command, in this
case LaTeX, so you can copy it back to the client. You can do that
with the subprocess module in the Python standard library.

If the command generated so much output so fast that you felt the need
to avoid the extra copy, I suppose you could fork() then hook stdout
directly to socket connected to the client with dup2(), then exec()
the command. But no need for that just to capture LaTeX's output.


--
--Bryan Olson



More information about the Python-list mailing list