Opened 5 years ago
Closed 5 years ago
#20765 closed defect (invalid)
load not working via http
Reported by: | mderickx | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | misc | Keywords: | |
Cc: | mstreng | Merged in: | |
Authors: | Reviewers: | Travis Scrimshaw | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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
Change History (9)
comment:1 Changed 5 years ago by
- Description modified (diff)
- Summary changed from load not working via https to load not working via http
comment:2 Changed 5 years ago by
- Description modified (diff)
comment:3 Changed 5 years ago by
comment:4 Changed 5 years ago by
- Cc mstreng added
comment:5 Changed 5 years ago by
It seems like the culprit is that someone added a six.py file in misc so that the import is now importing from the local six.py file instead of the actual six file!
comment:6 Changed 5 years ago by
I found the solution. There is a stackoverflow question which answers how to get the system module. This is done by adding: from __future__ import absolute_import
at the top of remote_file.py
. I tested this and this indeed solves the problem. The thing I don't get though is how the doctest passes even before fixing this bug.
comment:7 Changed 5 years ago by
- Status changed from new to needs_review
Seems like it is already fixed in #20797 so this ticket can be closed.
comment:8 Changed 5 years ago by
- Milestone changed from sage-7.3 to sage-duplicate/invalid/wontfix
- Reviewers set to Travis Scrimshaw
- Status changed from needs_review to positive_review
comment:9 Changed 5 years ago by
- Resolution set to invalid
- Status changed from positive_review to closed
Actually the problem is already in
get_remote_file
which is called byload