Please Note
This is not a duplicate because the other people who've got that error message all were using an external python installation instead of sage -python /path/to.py
My Situation
I'm not able to execute scripts the following ways:
sage /path/to.sage
(preprocessed)sage /path/to.spyx
sage /path/to.py
sage -python /path/to.py
But I'm able to run correctly without problems:
sage $ load 'file'
The Traceback
When cython
compiles an .spyx
file:
Traceback (most recent call last):
[...]
File "_home_user_Dokumente_oak_code_sage_spyx_0.pyx", line 14, in init _home_user_Dokumente_oak_code_sage_spyx_0 (_home_user_Dokumente_oak_code_sage_spyx_0.c:754)
sg.var('a b c')
AttributeError: 'module' object has no attribute 'var'
The statement that there's no var
in the loaded module seems to be true because dir(sg)
wasn't able to find anything else than __doc__
and other "underscored items".
When python
tries to execute file (normal handwritten .py
or a sage
preprocessed .sage
):
Traceback (most recent call last):
File "sage2.py", line 2, in <module>
from sage.all_cmdline import * # import sage library
File "/home/user/Dokumente/oak/code/sage.py", line 4, in <module>
import sage.all as sg
ImportError: No module named all
The Source
#!/usr/bin/env sage -python
import sys
import sage.all as sg
print '== TESTOUTPUT =='
sg.var('a b c')
The Question
How can I get sage -python
(sage
's internal python
) to execute the files specified as command line argument correctly? How can I get sage.all
's members to get import
ed correctly?
Thanks - if anything's unclear concerning my question, please leave a comment.