#20765: load not working via http
----------------------------+------------------------
       Reporter:  mderickx  |        Owner:
           Type:  defect    |       Status:  new
       Priority:  major     |    Milestone:  sage-7.3
      Component:  misc      |   Resolution:
       Keywords:            |    Merged in:
        Authors:            |    Reviewers:
Report Upstream:  N/A       |  Work issues:
         Branch:            |       Commit:
   Dependencies:            |     Stopgaps:
----------------------------+------------------------
Description changed by mderickx:

Old description:

> In the file `src/sage/structure/sage_object` there is the following
> doctest
> {{{
> sage: u = 'http://sage.math.washington.edu/home/was/db/test.sobj'
> sage: s = load(u)
> }}}
> The doctest passes without problems, but executing the doctest manually
> fails, probably because of circular imports
>
> {{{
> lll:sage4 maarten$ ./sage -t --warn-long 34.5
> src/sage/structure/sage_object.pyx
> Running doctests with ID 2016-06-03-00-49-24-4048fd29.
> Git branch: master
> Using --optional=mpir,python2,sage
> Doctesting 1 file.
> sage -t --warn-long 34.5 src/sage/structure/sage_object.pyx
>     [204 tests, 8.22 s]
> ----------------------------------------------------------------------
> All tests passed!
> ----------------------------------------------------------------------
> Total time for all tests: 8.8 seconds
>     cpu time: 5.3 seconds
>     cumulative wall time: 8.2 seconds
> lll:sage4 maarten$ ./sage
> ┌────────────────────────────────────────────────────────────────────┐
> │ SageMath version 7.2, Release Date: 2016-05-15                     │
> │ Type "notebook()" for the browser-based notebook interface.        │
> │ Type "help()" for help.                                            │
> └────────────────────────────────────────────────────────────────────┘
> sage: u = 'http://sage.math.washington.edu/home/was/db/test.sobj'
> sage: s = load(u)
> Attempting to load remote file:
> http://sage.math.washington.edu/home/was/db/test.sobj
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call
> last)
> <ipython-input-2-3316b4211d6a> in <module>()
> ----> 1 s = load(u)
>
> /Applications/sage4/src/sage/structure/sage_object.pyx in
> sage.structure.sage_object.load
> (/Applications/sage4/src/build/cythonized/sage/structure/sage_object.c:11530)()
>    1023     if lower.startswith("http://";) or
> lower.startswith("https://";):
>    1024         from sage.misc.remote_file import get_remote_file
> -> 1025         filename = get_remote_file(filename, verbose=verbose)
>    1026         tmpfile_flag = True
>    1027     else:
>
> /Applications/sage4/local/lib/python2.7/site-
> packages/sage/misc/remote_file.pyc in get_remote_file(filename, verbose)
>      34
>      35     # import compatible with py2 and py3
> ---> 36     from six.moves.urllib.request import urlretrieve
>      37
>      38     global cur
>
> ImportError: No module named moves.urllib.request
> }}}
>
> This was on a machine running OS X 10.10

New description:

 In the file `src/sage/structure/sage_object` there is the following
 doctest
 {{{
 sage: u = 'http://sage.math.washington.edu/home/was/db/test.sobj'
 sage: s = load(u)
 }}}
 The doctest passes without problems when executed by `sage -t`, but
 executing the doctest manually in a sage session fails, probably because
 of circular imports

 {{{
 lll:sage4 maarten$ ./sage -t --warn-long 34.5
 src/sage/structure/sage_object.pyx
 Running doctests with ID 2016-06-03-00-49-24-4048fd29.
 Git branch: master
 Using --optional=mpir,python2,sage
 Doctesting 1 file.
 sage -t --warn-long 34.5 src/sage/structure/sage_object.pyx
     [204 tests, 8.22 s]
 ----------------------------------------------------------------------
 All tests passed!
 ----------------------------------------------------------------------
 Total time for all tests: 8.8 seconds
     cpu time: 5.3 seconds
     cumulative wall time: 8.2 seconds
 lll:sage4 maarten$ ./sage
 ┌────────────────────────────────────────────────────────────────────┐
 │ SageMath version 7.2, Release Date: 2016-05-15                     │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 sage: u = 'http://sage.math.washington.edu/home/was/db/test.sobj'
 sage: s = load(u)
 Attempting to load remote file:
 http://sage.math.washington.edu/home/was/db/test.sobj
 ---------------------------------------------------------------------------
 ImportError                               Traceback (most recent call
 last)
 <ipython-input-2-3316b4211d6a> in <module>()
 ----> 1 s = load(u)

 /Applications/sage4/src/sage/structure/sage_object.pyx in
 sage.structure.sage_object.load
 (/Applications/sage4/src/build/cythonized/sage/structure/sage_object.c:11530)()
    1023     if lower.startswith("http://";) or
 lower.startswith("https://";):
    1024         from sage.misc.remote_file import get_remote_file
 -> 1025         filename = get_remote_file(filename, verbose=verbose)
    1026         tmpfile_flag = True
    1027     else:

 /Applications/sage4/local/lib/python2.7/site-
 packages/sage/misc/remote_file.pyc in get_remote_file(filename, verbose)
      34
      35     # import compatible with py2 and py3
 ---> 36     from six.moves.urllib.request import urlretrieve
      37
      38     global cur

 ImportError: No module named moves.urllib.request
 }}}

 This was on a machine running OS X 10.10

--

--
Ticket URL: <http://trac.sagemath.org/ticket/20765#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to