There are a number of issues with subprocess and __exit__ , 12494 status fixed among them.
Program (which doesn't work as I had hoped, but that's not the issue):
'file p.py'
import subprocess as S
with S.Popen(('cat','-n',),shell=False,stdin=S.PIPE,stdout=S.PIPE,bufsize=1,universal_newlines=True) as p:
p.stdin.write('these\n')
print(p.stdout.readline())
Use:
$ python3 p.py
Traceback (most recent call last):
File "p.py", line 5, in <module>
print(p.stdout.readline())
KeyboardInterrupt
$
$ python p.py
Traceback (most recent call last):
File "p.py", line 3, in <module>
with S.Popen(('cat','-n',),shell=False,stdin=S.PIPE,stdout=S.PIPE,bufsize=1,universal_newlines=True) as p:
AttributeError: __exit__
$
$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> |