[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-16 Thread Valery Khamenya
Valery Khamenya added the comment: Terry, Senthil, thanks, for replying to this ticket. OK, to the question: 1. @Terry, here is the full example as for CPython 2.7 I am talking about and the output: # from urllib2 import Request, build_opener request = Request('http://exampl

[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-16 Thread Senthil Kumaran
Senthil Kumaran added the comment: Just as a quick guideline. If you are talking about context manager support for urlopen, it is available and present in 3.x but not on 2.7. And I fear, it is late to make it available on 2.7, because it is a feature. In any case, as Terry requested, a simple s

[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-16 Thread Terry J. Reedy
Terry J. Reedy added the comment: As I understand this, you are asking that 2.7 urllib2.build_opener().open(), which in 3.x is urllib.request.build_opener().open(), be upgraded to return an object that works as a context manager. Unless the docs say that this should already be the case, this

[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-10 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, orsenthil ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue12955] urllib2.build_opener().open() is not friendly to "with ... as:"

2011-09-10 Thread Valery Khamenya
New submission from Valery Khamenya : 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 i