Hello,

  I'm launching a script as follows:
<code>
p = subprocess.Popen(['./p.py', 'aa'])

p.wait()
</code>

  If p.py writes to sys.stdout, then it is shown on the console.
Looking at the console, then, it is hard to distinguish the output of
p.py from that of the script launching it. I'd like to do it so the
output looks like this:
<output>
output of launcher
p: output of launchee
p: more output of launchee
more output of launcher
</output>
  i.e., that each output line of p.py will be formatted so that it is
preceded by 'p:'.

  How should this be done, then? Should I write a file class, and pass
on object like so:
<code>
custom_f = custom_file(sys.stdout, line_prefix = 'p')

p = subprocess.Popen(['./p.py', 'aa'], stdout = custom_f)

p.wait()
</code>
or is a different option easier? Are there any links for writing
custom file classes?

  Thanks & Bye,

  TD

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to