Help need with subprocess communicate

Nicola Musatti nicola.musatti at gmail.com
Wed Jun 4 11:26:11 CEST 2008


On Jun 3, 11:04 pm, rdab... at gmail.com wrote:
> I'm trying to perform following type of operation from inside a python
> script.
> 1. Open an application shell (basically a tcl )
> 2. Run some commands on that shell and get outputs from each command
> 3. Close the shell
[...]
> Following is my code:
>
> from subprocess import *
> p2 = Popen('qdl_tcl',stdin=PIPE,stdout=PIPE)
> o,e = p2.communicate(input='qdl_help \n qdl_read  \n
> qdl_reg_group_list ')
>
> Please suggest a way to perform it interactively with killing the
> process each time I want to communicate with it.

Here's what you need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

Cheers,
Nicola Musatti




More information about the Python-list mailing list