This is because I run Privoxy on my machine as an HTTP proxy, *and*
specify proxy exceptions. If I turn off the proxying entirely (in
System Preferences / Network) things seem to work.
So, the code in Sage will work if I say,
% sage -python -c "import urllib; print
urllib.FancyURLopener({}).retrieve('http://www.sagemath.org//
packages')"
That is, explicitly disable proxies for this retrieval. But if I'm
behind a corporate firewall which *requires* proxies, that would fail
in turn...
This is a Python bug, #8883, fixed in Python 2.6.6 and 2.7. I presume
upgrading the version of Python used with Sage would be a major
undertaking...
On Nov 14, 9:34 am, Bill Janssen <[email protected]> wrote:
> % sage -python -c "import urllib; print
> urllib.urlretrieve('http://www.sagemath.org//packages')"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 94, in
> urlretrieve
> return _urlopener.retrieve(url, filename, reporthook, data)
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 238, in
> retrieve
> fp = self.open(url, data)
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 206, in
> open
> return getattr(self, name)(url)
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 317, in
> open_http
> if proxy_bypass(realhost):
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 1405, in
> proxy_bypass
> return proxy_bypass_macosx_sysconf(host)
> File "/local/sage-4.7.2/local/lib/python/urllib.py", line 1379, in
> proxy_bypass_macosx_sysconf
> mask = int(m.group(2)[1:])
> TypeError: 'NoneType' object is unsubscriptable
> % /usr/bin/python -c "import urllib; print
> urllib.urlretrieve('http://www.sagemath.org//packages')"
> ('/var/folders/Rg/Rg1suhnjFdSFgRrn7ZA-jk+++TM/-Tmp-/tmp6YfkKf',
> <httplib.HTTPMessage instance at 0x2ad238>)
> %
>
> On Nov 14, 9:29 am, Bill Janssen <[email protected]> wrote:
>
>
>
>
>
>
>
> > Maybe this is because I built the install under /tmp, then moved it
> > to /local afterwards?
>
> > More likely, your machine is configured in some way that allows this,
> > and mine is not.
>
> > On Nov 14, 9:22 am, William Stein <[email protected]> wrote:
>
> > > On 11/14/11 9:02 AM, Bill Janssen wrote:
>
> > > > I'm using Sage 4.7.2, built from source, on OS X 10.5 Leopard. When I
> > > > try to list the experimental packages, or install one of them, I get
> > > > the following traceback:
>
> > > > % sage -optional
> > > > Using SAGE Serverhttp://www.sagemath.org//packages
> > > >http://www.sagemath.org//packages/optional/list--> /local/sage-4.7.2/
> > > > tmp/list
> > > > Traceback (most recent call last):
> > > > File "/local/sage-4.7.2/local/bin/sage-list-packages", line 29, in
> > > > <module>
> > > > urllib.urlretrieve(url, file)
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 94, in
> > > > urlretrieve
> > > > return _urlopener.retrieve(url, filename, reporthook, data)
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 238, in
> > > > retrieve
> > > > fp = self.open(url, data)
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 206, in
> > > > open
> > > > return getattr(self, name)(url)
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 317, in
> > > > open_http
> > > > if proxy_bypass(realhost):
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 1405, in
> > > > proxy_bypass
> > > > return proxy_bypass_macosx_sysconf(host)
> > > > File "/local/sage-4.7.2/local/lib/python/urllib.py", line 1379, in
> > > > proxy_bypass_macosx_sysconf
> > > > mask = int(m.group(2)[1:])
> > > > TypeError: 'NoneType' object is unsubscriptable
> > > > %
>
> > > > Known bug?
>
> > > Not to me. It works fine for me. I've never seen the above issue
> > > before, actually. Hmmm.
>
> > > William
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org