[New-bugs-announce] [issue12576] urlib.request fails to open some sites

Ugra Dániel report at bugs.python.org
Sun Jul 17 02:07:44 CEST 2011

New submission from Ugra Dániel <daniel.ugra at gmail.com>:

Issue #12133 introduced a patch which seems to cause problems.
I'm using Python 3.2.1 on 64-bit Arch Linux (this version already incorporates the changes from #12133).

The following code:

with urllib.request.urlopen(url) as page:

raises "ValueError: I/O operation on closed file." exception when url is "http://www.imdb.com/".
When I removed "h.close()" (added by the patch) from request.py everything worked as expected.
Other URLs work flawlessly with patched code ("http://www.google.com/" for example).

Maybe it is something to do with differences in HTTP responses or in server-side behavior.
For example IMDb's "Cneonction: close" (not a typo) feature.
But this could be totally unrelated, I am by no means an HTTP expert.

components: Library (Lib)
messages: 140512
nosy: daniel.ugra
priority: normal
severity: normal
status: open
title: urlib.request fails to open some sites
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list