EOFError: EOF when reading a line

Discussion in 'Python' started by Mihir Patel, Mar 11, 2010.

  1. Mihir Patel

    Mihir Patel Guest

    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
     
    Mihir Patel, Mar 11, 2010
    #1
    1. Advertising

  2. En Thu, 11 Mar 2010 06:12:02 -0300, Mihir Patel <>
    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
     
    Gabriel Genellina, Mar 12, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Bear

    EOFError not getting raised

    David Bear, Jun 10, 2005, in forum: Python
    Replies:
    2
    Views:
    418
  2. Kobu
    Replies:
    10
    Views:
    640
    Keith Thompson
    Mar 4, 2005
  3. Ground21
    Replies:
    24
    Views:
    772
    kwikius
    Feb 26, 2007
  4. SpreadTooThin

    ifstream eof not reporting eof?

    SpreadTooThin, Jun 13, 2007, in forum: C++
    Replies:
    10
    Views:
    707
    James Kanze
    Jun 15, 2007
  5. Jan Burse
    Replies:
    67
    Views:
    1,083
    Jan Burse
    Mar 14, 2012
Loading...

Share This Page