New submission from albert Mietus alb...@mietus.nl:
The functions urlparse.url{,un}split() and urllib{,2}.open() do not work
together for relative, local files, due a bug in urlunsplit.
Given a file f='./rel/path/to/file.html' it can be open directly by
urllib.open(f), but not in urllib2! as the later needs a scheme.
We can create a sound url with spilt/unspilt and a default scheme:
f2=urlparse.urlunsplit(urlparse.urlsplit(f,'file')); which works most
cases, HOWEVER a bogus netloc is added for relative filepaths.
If have isolated this buggy function, added some local testcode and
made patch/workaround in my file 'unsplit.py' Which is included. Hope
this will contribute to a real patch.
--Groetjes, Albert
ALbert Mietus
Don't send spam mail!
Mijn missie: http://SoftwareBeterMaken.nl product, proces imago.
Mijn leven in het kort:
http://albert.mietus.nl/Doc/CV_ALbert.html
--
components: Library (Lib)
files: unsplit.py
messages: 91222
nosy: albert
severity: normal
status: open
title: urlparse.urlunsplit() can't handle relative files (for urllib*.open()
type: performance
Added file: http://bugs.python.org/file14637/unsplit.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6631
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com