build/sage_bootstrap/download/mirror_list.py already uses a py2/py3 
compatibility module for urllib:
see build/sage_bootstrap/compat/__init__.py

On Saturday, May 23, 2020 at 4:58:22 PM UTC-7, kcrisman wrote:
>
>
>
> On Saturday, May 23, 2020 at 2:44:04 PM UTC-4, Matthias Köppe wrote:
>>
>> For debugging this, please note that this is executed using 
>> build/bin/sage-system-python, which is not necessarily the same as ./sage 
>> -python.
>>
>>>
>>>
>
> Interesting.  In which case my system Python is always py2.  Here is 
> another data point, from a Python 3 build (hopefully zooming to mirrors 
> soon).  urllib doesn't like 
>
> $ ./build/bin/sage-system-python 
>
> Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
>
> [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import urllib
>
> >>> eval(urllib.urlopen('http://www.sagemath.org/mirror_list').read())
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
>   File "<string>", line 1
>
>     error code: 1010
>
>              ^
>
> SyntaxError: invalid syntax
>
> >>> urllib.urlopen('http://www.sagemath.org/mirror_list').read()
>
> 'error code: 1010'
>
> $ ./sage -python
>
> Python 3.7.3 (default, May 23 2020, 09:48:14) 
>
> [Clang 7.3.0 (clang-703.0.31)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import urllib
>
> >>> eval(urllib.urlopen('http://www.sagemath.org/mirror_list').read())
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
> AttributeError: module 'urllib' has no attribute 'urlopen'
>
> >>> urllib.urlopen('http://www.sagemath.org/mirror_list').read()
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'urllib' has no attribute 'url open' 
>
>
> From https://docs.python.org/3/library/urllib.request.html: The legacy 
> urllib.urlopen function from Python 2.6 and earlier has been 
> discontinued; urllib.request.urlopen() 
> <https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen>
>  corresponds 
> to the old urllib2.urlopen.
>
> Note that 
> https://github.com/sagemath/sage/blob/4427340fcd58c915e9b803cb5fbc8e720a8c335c/build/sage_bootstrap/download/mirror_list.py#L179
>  
> still has one instance of this function while 
> https://github.com/sagemath/website/blob/785f16e785721e51e1c222bbb2e17d5dcc54cb07/scripts/mirror_manager.py#L456
>  
> has some references to this which is presumably where I got it from.
>
> But in any case that is the error.  Conceivably relevant: 
> * https://twitter.com/scottmmjackson/status/1215639072464613377
> I tried to trace it further but I just don't have time to do so, as it 
> really starts to require messing with the entire mirror list module and I 
> mainly just wanted to build binaries.  But I think these things should be 
> looked into, especially the implied (if not actual) use of urllib.urlopen.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-release/95085bfb-bf96-4283-b05e-4c5225f10c09%40googlegroups.com.

Reply via email to