EOFError: EOF when reading a line

M

Mihir Patel

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
 
G

Gabriel Genellina

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top