[Python-Dev] test_urllib2 fails on Win98SE (original) (raw)

Tim Peters tim.one@home.com
Wed, 9 May 2001 15:30:41 -0400


test_urliib2 takes > 30 seconds, then fails:

C:\Code\python\dist\src\PCbuild>python ../lib/test/test_urllib2.py Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 15, in ? f = urllib2.urlopen(file_url) File "c:\code\python\dist\src\lib\urllib2.py", line 135, in urlopen return _opener.open(url, data) File "c:\code\python\dist\src\lib\urllib2.py", line 319, in open '_open', req) File "c:\code\python\dist\src\lib\urllib2.py", line 298, in _call_chain result = func(*args) File "c:\code\python\dist\src\lib\urllib2.py", line 904, in file_open return self.open_local_file(req) File "c:\code\python\dist\src\lib\urllib2.py", line 923, in open_local_file if not host or
socket.error: host not found

The URL it's passing is

file://c:\code\python\dist\src\lib\urllib2.pyc

If I change test_urllib2's

file_url = "[file://%s"](file://%s) % urllib2.__file__

to (adding another slash)

file_url = "[file:///%s"](https://mdsite.deno.dev/file:///%s) % urllib2.__file__

then it fails like this instead, but very quickly:

C:\Code\python\dist\src\PCbuild>python ../lib/test/test_urllib2.py Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 15, in ? f = urllib2.urlopen(file_url) File "c:\code\python\dist\src\lib\urllib2.py", line 135, in urlopen return _opener.open(url, data) File "c:\code\python\dist\src\lib\urllib2.py", line 319, in open '_open', req) File "c:\code\python\dist\src\lib\urllib2.py", line 298, in _call_chain result = func(*args) File "c:\code\python\dist\src\lib\urllib2.py", line 904, in file_open return self.open_local_file(req) File "c:\code\python\dist\src\lib\urllib2.py", line 925, in open_local_file return addinfourl(open(url2pathname(file), 'rb'), IOError: [Errno 2] No such file or directory: '\c:\code\python\dist\src\lib\urllib2.pyc'

Here's what I know about URLs: .

Here's what I know about file URLs: .

Here's what I know about file URLs on Windows: .

If I type the original

[file://c:\code\python\dist\src\lib\urllib2.pyc](https://mdsite.deno.dev/file:///c:/code/python/dist/src/lib/urllib2.pyc)

into IE's address bar, it actually executes urllib2.