Yes, there is. Try the “subprocess.Popen” command in python (
http://docs.python.org/library/subprocess.html). The one thing in this
that you will need to modify slightly is in the calls to set up the
you need to to use “subprocess.PIPE” instead of simply “PIPE”.
At this point, you could use the pipe to communicate to the other
both ways. The easiest way I have found for this is with the
and “os.write(…)” commands. One thing about the os.write and os.read
commands is that for the first parameter you will need the file
number, not the file descriptor.
To get this, lets say you assign the subprocess to “p”; in order to get
file number in order to talk to the child process, you would type in
“p.stdin.fileno()” to write to the process, or “p.stdout.fileno()” to
from the process. Another simple way to write to a process at startup
pass it arguments.
Here is some source code that shows how to do this (
On line 40, this shows how to dynamically assign arguments to a child
process with the subprocess.Popen command, as well as how to read in the
arguments very simply on lines 7, 15, 23, 31 with the use of the argv
(mind you that argv is the process name). This example also shows
use the os.write on lines 42 and 43.
On Tue, Jan 26, 2010 at 7:04 PM, Muhammad Ali K. [email protected]
[email protected]> wrote:
another (.py) extension file. i am tired of searching on websites but