EOFError: EOF when reading a line

Issue #28 resolved
pahaz NA created an issue

I trying to run this code:

from sarge import Feeder, run, Capture
# import logging
# from sarge import logger
# l = logger
# l.setLevel(logging.DEBUG)
# l.addHandler(logging.StreamHandler())

feeder = Feeder()
cin = Capture(buffer_size=1)
cout = Capture(buffer_size=1)
pipe = run('cat | python -c "while 1: print(input().upper())"', input=feeder, stdout=cin, stderr=cout, async=True)
pipe.wait_events()

feeder.feed('Hello')
feeder.feed(b'Goodbye\n')
feeder.close()

pipe.close()

print(pipe.stdout.text, pipe.stderr.text)
# print(pipe.stderr.text)

and got this:

(venv)vagrant@precise64:/vagrant$ python test_sarger.py
HELLOGOODBYE
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
EOFError: EOF when reading a line

or this on Py2:

C:\Users\pahaz_000>C:\Python27\python.exe test_sarger.py
(u'HELLOGOODBYE\r\n', u'Traceback (most recent call last):\r\n  File "<string>", line 1, in <module>\r\nEOFError: EOF when reading a line\r\n')

I understand that pipe.stderr.text is empty but I think that I must have get '' (empty string).

Comments (4)

  1. pahaz NA reporter

    Sorry, this is not a sarge issus. this text produced by python -c "while 1: print(input().upper())" script.

  2. Vinay Sajip repo owner

    Hi pahaz, you've certainly been busy. I'm pretty snowed under with other work at present and not sure when I'll be able to look properly at your various issues and pull requests. I'll look at them as soon as time permits. As this issue demonstrates - please don't be too hasty to post issues unless you are really sure they really are issues. Working with processes and threads running asynchronously can be difficult, and sometimes what seem to be issues are actually user errors or misconceptions.

  3. Log in to comment