New submission from Valery Khamenya <khame...@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@python
components: Documentation, IO, Library (Lib)
messages: 143836
nosy: Valery.Khamenya, docs@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12955>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to