Title: urllib2 mangles file://-scheme URLs
Type: behavior Stage: resolved
Components: Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: dabrahams, exarkun, orsenthil
Priority: normal Keywords:

Created on 2010-05-08 01:45 by dabrahams, last changed 2010-05-08 05:15 by orsenthil. This issue is now closed.

Messages (5)
msg105250 - (view) Author: Dave Abrahams (dabrahams) Date: 2010-05-08 01:45
$ touch /tmp/x.html
$ python -c 'import urllib2;resp=urllib2.urlopen("file:///tmp/x.html");print resp.geturl()'

note the missing // after the colon
msg105255 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-05-08 03:32
Fixed in r80953, r80954 , r80955 and r80956.
msg105258 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2010-05-08 04:34
Major buildbot failures caused by this change, eg:

ERROR: test_file (test.test_urllib2net.OtherNetworkTests)
Traceback (most recent call last):
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/", line 126, in test_file
    self._test_urls(urls, self._extra_handlers(), retry=True)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/", line 175, in _test_urls
    f = urlopen(url, req, TIMEOUT)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/", line 28, in wrapped
    return _retry_thrice(func, exc, *args, **kwargs)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/", line 19, in _retry_thrice
    return func(*args, **kwargs)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/", line 391, in open
    response = self._open(req, data)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/", line 409, in _open
    '_open', req)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/", line 369, in _call_chain
    result = func(*args)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/", line 1257, in file_open
    return self.open_local_file(req)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/", line 1291, in open_local_file
    headers, 'file://'+ host + file)
TypeError: cannot concatenate 'str' and 'NoneType' objects
msg105259 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-05-08 04:37
On Sat, May 8, 2010 at 10:04 AM, Jean-Paul Calderone
<> wrote:
> TypeError: cannot concatenate 'str' and 'NoneType' objects

Okay, I see where the problem is. I shall quickly fix it.
msg105263 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-05-08 05:15
Fixed the change which resulted in Buildbots failure. Those should
turn green now.
Date User Action Args
2010-05-08 05:15:52orsenthilsetmessages: + msg105263
2010-05-08 04:37:54orsenthilsetmessages: + msg105259
2010-05-08 04:34:46exarkunsetnosy: + exarkun
messages: + msg105258
2010-05-08 03:32:26orsenthilsetstatus: open -> closed

type: behavior
assignee: orsenthil

nosy: + orsenthil
messages: + msg105255
resolution: fixed
stage: resolved
2010-05-08 01:45:27dabrahamscreate