getproxies() in python2.3/mac
June 7th, 2007
Irritating:
$ python2.3 -c 'import urllib; print urllib.getproxies()'
{}
$ python2.4 -c 'import urllib; print urllib.getproxies()'
{'http': 'http://localhost:8501'}
Is it documented somewhere that getproxies() just plain doesn’t work in OS X with the Apple-supplied 2.3 build?
You can leave a response, or trackback from your own site.
3 Responses to “getproxies() in python2.3/mac”
This is because in python2.3’s urllib.py, Mac OS is detected by os.name == ‘mac’, but os.name actually returns ‘posix’ with the apple-supplied build. In python2.5, Mac OS detection now uses sys.platform == ‘darwin’.
But, I’ve never seen that documented. Of course, I’ve never seen the function getproxies() itself documented, either.
comment posted at 12:33 pm on 07 Jun 2007
A fellow tells me this is because Python 2.3 urllib had a bug in getproxies(), since fixed.
comment posted at 12:38 pm on 07 Jun 2007
@ctate: Yeah, looking through the source it appears 2.3 has an OS9-centric test for Macness:
2.4 chooses instead the more accurate incantation for OS X:
Sigh.
@Jon:
getproxies()isn’t documented, which is fine by me, but becauseurlopen()relies on it to Do The Right Thing, its correctness is critical.comment posted at 1:26 pm on 07 Jun 2007