EOFError: EOF when reading a line

Mihir Patel mihir3445 at gmail.com
Thu Mar 11 10:12:02 CET 2010


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



More information about the Python-list mailing list