[issue13202] subprocess __exit__ attribute missing

David W. Lambert report at bugs.python.org
Mon Oct 17 17:03:16 CEST 2011


New submission from David W. Lambert <b49P23TIvg at stny.rr.com>:

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.
>>>

----------
components: Interpreter Core, Library (Lib)
messages: 145707
nosy: LambertDW
priority: normal
severity: normal
status: open
title: subprocess __exit__ attribute missing
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13202>
_______________________________________


More information about the Python-bugs-list mailing list