[ python-Bugs-1591774 ] Urllib2.urlopen() raises OSError w/bad HTTP Location header

SourceForge.net noreply at sourceforge.net
Sun Feb 25 00:23:29 CET 2007


Bugs item #1591774, was opened at 2006-11-06 20:08
Message generated for change (Comment added) made by jseutter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1591774&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: nikitathespider (nikitathespider)
Assigned to: Nobody/Anonymous (nobody)
Summary: Urllib2.urlopen() raises OSError w/bad HTTP Location header

Initial Comment:
The documentation for urllib2.urlopen() says that it
"[r]aises URLError on errors". But if urllib2 requests
a resource from a (misconfigured) Web server and that
server returns 302 response with the Location header
set to "file:", urlopen raises "OSError: [Errno 2] No
such file or directory: ''". I have seen such a
misconfiguration in the wild; I've also created a URL
on my server that reproduces the problem in case the
real-world URL disappears or is fixed. Both URLs are in
the attachment with code to reproduce the problem.

I can recreate this under Python 2.3 - 2.5 under Mac OS
X, FreeBSD and Win2k.

I would be satisfied if the module simply followed the
documentation and actually returned URLError.


----------------------------------------------------------------------

Comment By: Jerry Seutter (jseutter)
Date: 2007-02-24 16:23

Message:
Logged In: YES 
user_id=1727609
Originator: NO

Fix submitted in patch 1668100 - urllib2.urlopen() raises OSError instead
of URLError

http://sourceforge.net/tracker/index.php?func=detail&aid=1668100&group_id=5470&atid=305470

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1591774&group_id=5470


More information about the Python-bugs-list mailing list