[issue12955] urllib.request example should use with ... as:

2015-04-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6d5336a193cc by Berker Peksag in branch '3.4': Issue #12955: Change the urlopen() examples to use context managers where appropriate. https://hg.python.org/cpython/rev/6d5336a193cc New changeset 08adaaf08697 by Berker Peksag in branch 'default':

[issue12955] urllib.request example should use with ... as:

2015-04-12 Thread Berker Peksag
Berker Peksag added the comment: Great patch. Thanks Martin. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955

[issue12955] urllib.request example should use with ... as:

2015-02-14 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +berker.peksag stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955 ___

[issue12955] urllib.request example should use with ... as:

2015-02-08 Thread Martin Panter
Martin Panter added the comment: Issue 22755 is about the example arms race for contextlib.closing(). -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955 ___

[issue12955] urllib.request example should use with ... as:

2015-02-08 Thread Martin Panter
Martin Panter added the comment: Here is a patch to change the urlopen() examples to use context managers where appropriate. There were also a few examples of handling HTTPError which I didn’t touch, because the whole file object versus exception object thing is probably a separate can of

[issue12955] urllib.request example should use with ... as:

2014-07-14 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955 ___

[issue12955] urllib.request example should use with ... as:

2013-12-05 Thread Alexander Boyd
Changes by Alexander Boyd a...@opengroove.org: -- nosy: +javawizard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955 ___ ___ Python-bugs-list

[issue12955] urllib.request example should use with ... as:

2012-02-03 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Senthil: http://docs.python.org/dev/library/contextlib.html#contextlib.closing currently has this example: from urllib.request import urlopen with closing(urlopen('http://www.python.org')) as page: which is misleading in that the object

[issue12955] urllib.request example should use with ... as:

2012-02-03 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Either we find a commonly used stdlib class that is not a context manager but has a close method and is not going to become a context manager (I can’t see why such a thing would be), or we can add something like: “closing is useful with code

[issue12955] urllib.request example should use with ... as:

2011-09-17 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: [Terry] But when I add 'http:www.python.org' as an argument, I get urllib.error.URLError: urlopen error no host given Your URI lacks a host (netloc, in RFC parlance) component: urllib.parse.urlparse('http:python.org')

[issue12955] urllib.request example should use with ... as:

2011-09-16 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: On 3.2.2, your example (adapted) produces 2945 characters fetched So, as Senthil said, the requested feature already exists. But it cannot be added to the 2.7 series; the Python 2.7 *language* is feature frozen. 2.7.z bug fixes serve to

[issue12955] urllib.request example should use with ... as:

2011-09-16 Thread Valery Khamenya
Valery Khamenya khame...@gmail.com added the comment: Guys, in my item 2 the simplistic goal was stated clearly: open, read and close. Do you confirm that this basic sequence is not supported by urllib2 under 2.7 ? (I just requested for a tiny documentation update entry) regards, Valery

[issue12955] urllib.request example should use with ... as:

2011-09-16 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: Valery, yes. I shall update 2.7 documentation with this known limitation and 3.x documentation with the example usage scenarios. Thanks! -- assignee: docs@python - orsenthil ___ Python tracker