[Python-Dev] urllib2

Gordon McMillan gmcm@hypernet.com
Thu, 7 Jun 2001 09:06:55 -0400


[Tim & Paul on file URLs]

[Tim]
> But on Windows, urllib2.urlopen() throws up even on URLs like:
> 
>     file:///c:/bootlog.txt

Curiously enough,
  url = "file:///" + urllib.quote_plus(fnm)
seems to work on Windows. It even seems to work on mac, if 
you first turn '/' into '%2f', then undo the double quoting (turn 
'%252f' back into '%2f' in the ensuing url).

It even seems to work on mac directory names with Unicode 
characters in them (though I haven't looked too closely, in fear 
of jinxing it).

eye-of-newt-considered-helpful-ly y'rs


- Gordon