I found where sage was actually trying to download the file, and copied
that code to write a little test, which looks like

import sys

try:
        # Python 3
    import urllib.request as urllib
except ImportError:
    import urllib

# Change the URLopener to raise an exception on HTTP errors
def http_error_default(url, fp, errcode, errmsg, headers):
    fp.close()
    raise IOError(errcode, errmsg, url)

opener = urllib.FancyURLopener()
opener.http_error_default = http_error_default

# This reporthook is used below to print ...'s as the file downloads.
global cur
cur = 0
def reporthook(block, size, total):
    global cur
    n = 60*block*size
    # n ranges from 0 to 60*total, so we'll print at most 60 dots
    if n >= cur + total:
        sys.stderr.write('.')
        sys.stderr.flush()
        cur += total
sys.stderr.write('[')
sys.stderr.flush()
filename, info = opener.retrieve('http://www.sagemath.org/index.html',
'/dev/stdout', reporthook)
sys.stderr.write(']\n')

and I get funny results.

jb12407@lmfdb3:~/test$ python urlopen.py
[.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
[...]
<!-- This file was automatically generated by the script
     /home/sagemath/www2-dev/www/mirrordevel on Sun Dec 15 18:35:29 UTC
2013 -->
[...]
<html xmlns="http://www.w3.org/1999/xhtml";
      lang="en"
      xml:lang="en">
<head profile="http://a9.com/-/spec/opensearch/1.1/";>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
[...]

works as expected. However,

jb12407@lmfdb3:~/test$ python urlopen.py > output
[Traceback (most recent call last):
  File "urlopen.py", line 30, in <module>
    filename, info = opener.retrieve('http://www.sagemath.org/index.html',
'/dev/stdout', reporthook)
  File "/usr/lib64/python2.6/urllib.py", line 243, in retrieve
    tfp = open(filename, 'wb')
IOError: [Errno 20] Not a directory: '/dev/stdout'

gives the error.

I don't know why. However, having just spent a bit of time fighting with
selinux while setting up apache stuff, I've decided that this must also be
some sort of strange selinux issue. Meanwhile, I can still install packages
by downloading them manually and putting them in the right place so that
sage doesn't download them.



On Fri, Mar 14, 2014 at 3:45 PM, Jonathan Bober <[email protected]> wrote:

> On Thu, Mar 13, 2014 at 6:45 PM, Volker Braun <[email protected]>wrote:
>
>> export LC_ALL=C
>>
>> and try again
>>
>
> That doesn't make a difference.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-release" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-release.
For more options, visit https://groups.google.com/d/optout.

Reply via email to