Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Running sage dependent scripts throws error

script1.sage:

#!/usr/bin/env sage
import script2

script2.sage:

#!/usr/bin/env sage
smth

After I've done:

sage script2.sage # script2.py was generated
sage script1.sage # script1.py generated that uses script2.py

Both script1 and script2 do have:

from sage.all_cmdline import *

Everything works good if I:

/usr/bin/env sage script1.sage # or
sage script1.sage

But when trying to run scripts in this way:

./script1.sage
# =>
# from sage.all_cmdline import *   # import sage library
# ImportError: No module named sage.all_cmdline

Why?

Running sage dependent scripts throws error

script1.sage:

#!/usr/bin/env sage
import script2

script2.sage:

#!/usr/bin/env sage
smth

After I've done:

sage script2.sage # script2.py was generated
sage script1.sage # script1.py generated that uses script2.py

Both script1 and script2 do have:

from sage.all_cmdline import *

Everything works good if I:

/usr/bin/env sage script1.sage # or
sage script1.sage

But when trying to run scripts in this way:

./script1.sage
# =>
# Traceback (most recent call last):
# File "./script1.sage", line 4, in <module>
#   import script2
# File "path/script2.py", line 2, in <module>
#   from sage.all_cmdline import *   # import sage library
# #

ImportError: No module named sage.all_cmdline sage.all_cmdline

Why?

Running sage dependent scripts throws error

script1.sage:

#!/usr/bin/env sage
import script2

script2.sage:

#!/usr/bin/env sage
smth

After I've done:

sage script2.sage # script2.py was generated
sage script1.sage # script1.py generated that uses script2.py

Both script1 and script2 do have:

from sage.all_cmdline import *

Everything works good if I:

/usr/bin/env sage script1.sage # or
sage script1.sage

But when trying to run scripts in this way:

./script1.sage
# =>
# Traceback (most recent call last):
# File "./script1.sage", line 4, in <module>
#   import script2
# File "path/script2.py", line 2, in <module>
#   from sage.all_cmdline import *   # import sage library
#

# ImportError: No module named sage.all_cmdline

sage.all_cmdline

Why?

Running sage dependent scripts throws error

script1.sage:

#!/usr/bin/env sage
import script2

script2.sage:

#!/usr/bin/env sage
smth

After I've done:

sage script2.sage # script2.py was generated
sage script1.sage # script1.py generated that uses script2.py

Both script1 and script2 do have:

from sage.all_cmdline import *

Everything works good if I:

/usr/bin/env sage script1.sage # or
sage script1.sage

But when trying to run scripts script1.sage in this way:

./script1.sage
# =>
# Traceback (most recent call last):
# File "./script1.sage", line 4, in <module>
#   import script2
# File "path/script2.py", line 2, in <module>
#   from sage.all_cmdline import *   # import sage library
# ImportError: No module named sage.all_cmdline

Why?