How to use popen ?

harvey smith harvey at tunes.norfolk.street
Fri May 4 22:59:08 EDT 2001


I'd like to be able to start another process and send (write to it)
commands. I want the other processes output to be unaffected, as i
don't need to process the output from it in any way, i just need to
see it.

As a test to figure this out I try th following: (running dc in rxvt
and trying to add a couple numbers and see results)

:import os
:
:fp = os.popen('rxvt -e dc','w')
:fp.write('12 3+p')
:fp.close()
:print "all done"

Though an rxvt term opens just fine, running dc as expected, the
write, "12 3+p", never shows up. Once I exit out of dc "all done" prints and no
errors are displayed.

So what obvious thing am I doing wrong?

Harvey





More information about the Python-list mailing list