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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top