[issue16301] localhost() and thishost() in urllib/request.py

Senthil Kumaran report at bugs.python.org
Tue Oct 23 18:38:41 CEST 2012


Senthil Kumaran added the comment:

> Serhiy Storchaka added the comment:
>
>> +        tmp_fileurl = 'file://localhost' + tmp_file
>
>         tmp_fileurl = 'file://localhost/' + tmp_file.replace(os.path.sep, '/')

Ok, I realized the mistake. 'file://localhost' + tmpfile is getting
expanded to 'file://localhostc:\something\..'
Yeah, the final '/' missing was the problem.

tmp_file.replace(...) is be better too, initial unwrap was encoding /
and  url2pathname to //. replacing path sep with '/' would be better.

Thanks for the suggestion, Serhiy.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16301>
_______________________________________


More information about the Python-bugs-list mailing list