Python Embedding: redirecting output

Monty Brandenberg (montyb@hks.com)
8 Feb 1995 16:44:38 GMT

I'm busy embedding Python into a distributed application environment
and I need to gather up Python's normal and exceptional text output
and return it to the application's front end as part of a command's
return value. While driving from the top is easy with run_command(),
gathering the output seems non-trivial. So far, my strongest candidate
is to reimplement output on the standard sys.stderr and sys.stdout
objects and to diddle run_command() to initiate and terminate
result gathering. Have others done this and found better ways or
have suggestions to give?

tnx

--

Monty Brandenberg montyb@hks.com Consulting for: mcbinc@world.std.com Hibbitt, Karlsson & Sorensen, Inc. Tel: (401) 727-4200 x4473 1080 Main Street, Pawtucket, RI 02860 Fax: (401) 727-4208