[New-bugs-announce] [issue5418] urllib.response.addinfourl does not support __exit__

Mitchell Model report at bugs.python.org
Thu Mar 5 01:58:40 CET 2009


New submission from Mitchell Model <mlm at acm.org>:

response = urllib.request.open(someURL)
    page = response.read()

close() be called on response after the read(), right?  Experimentation 
shows that I can repeatedly read from response until I close it, getting 
back empty bytes objects.

Thinking that anything with a close() should support the with statement, 
I tried putting  the code inside one but got
        AttributeError: 'addinfourl' object has no attribute '__exit__'
so I can see that it doesn't support with. It seems like it should.

----------
components: Library (Lib)
messages: 83174
nosy: MLModel
severity: normal
status: open
title: urllib.response.addinfourl does not support __exit__
type: behavior
versions: Python 3.0, Python 3.1

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


More information about the New-bugs-announce mailing list