[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"
Valery Khamenya
report at bugs.python.org
Sat Sep 10 12:30:28 CEST 2011
New submission from Valery Khamenya <khamenya at gmail.com>:
The following intuitive construction
with urllib2.build_opener().open() as:
...
leads to AttributeError: addinfourl instance has no attribute '__exit__'
http://docs.python.org/library/urllib2.html says almost nothing about concept of closing.
Could it be possible to add a canonical "with ... as:" example for urllib2.build_opener() ?
Thanks,
Valery
----------
assignee: docs at python
components: Documentation, IO, Library (Lib)
messages: 143836
nosy: Valery.Khamenya, docs at python
priority: normal
severity: normal
status: open
title: urllib2.build_opener().open() is not friendly to "with ... as:"
type: resource usage
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12955>
_______________________________________
More information about the Python-bugs-list
mailing list