urllib.urlopen("file://...") fails
Seth Delackner
seth at jtan.com
Thu Apr 25 11:27:55 EDT 2002
Fernando PĂ©rez <fperez528 at yahoo.com> writes:
> Seth Delackner wrote:
>>>>> u = urllib.urlopen("file:///t:/tmp/package.html")
> ^
>
> One / too many? You're directing it to \t:\.... which it obviously
> can't find.
>
> I don't run windows so I can't test so I may be wrong. It just looks
> like that is your problem.
You would think, right? But I just tried 'file://t:/tmp/package.html'
and that bombed:
>>> urllib.urlopen('file://t:/tmp/package.html')
Traceback (most recent call last):
File "<pyshell#114>", line 1, in ?
urllib.urlopen('file://t:/tmp/package.html')
File "d:\python\lib\urllib.py", line 73, in urlopen
return _urlopener.open(url)
File "d:\python\lib\urllib.py", line 178, in open
return getattr(self, name)(url)
File "d:\python\lib\urllib.py", line 403, in open_file
return self.open_ftp(url)
File "d:\python\lib\urllib.py", line 447, in open_ftp
host = socket.gethostbyname(host)
IOError: [Errno socket error] (7, 'getaddrinfo failed')
The only thing that actually works for me is:
>>> urllib.urlopen('file:t:/tmp/package.html')
Which is not even a valid url!
More information about the Python-list
mailing list