From: Mihir Patel on
I am trying to use the subprocess to send the data to child process. I
am not sure why i keep getting "EOFError: EOF when reading a line"

i am using Python 2.4.3, GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on
64bit linux ,centos

Thanks

output :
=====
Traceback (most recent call last):
File "test_input.py", line 3, in ?
x = raw_input()
EOFError: EOF when reading a line
output: hello



Main Program:
===========

command_line = 'python test_input.py'
p =subprocess.Popen(command_line, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
print 'output:', p.communicate()[0]

o,e = p.communicate('test')

print "out:",o
print "error:",e
p.stdout.close()

print "Exit Success"



test_input.py
==========
print 'hello\n'

x = raw_input()

print x
From: Gabriel Genellina on
En Thu, 11 Mar 2010 06:12:02 -0300, Mihir Patel <mihir3445(a)gmail.com>
escribi�:

> I am trying to use the subprocess to send the data to child process. I
> am not sure why i keep getting "EOFError: EOF when reading a line"
>
> command_line = 'python test_input.py'
> p =subprocess.Popen(command_line, shell=True, stdin=subprocess.PIPE,
> stdout=subprocess.PIPE)
> print 'output:', p.communicate()[0]
>
> o,e = p.communicate('test')

You may call communicate at most once.

--
Gabriel Genellina