Running sage (8.9) from command line (Windows)
I want to run sage in the cmd. I heard the command is ("nearly")
C:\Programme\SageMath8.9\runtime\bin\bash -l
C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage
C:/Users/ccc/Desktop/Test/SageTeX/sagebsp01.sagetex.sage
But this gives me several errors
What have I to do?
€dit: Anyway...
C:\Programme\SageMath8.9\runtime\bin\bash -l C:/Programme/SageMath8.9/runtime/opt/sagemath-8.9/sage
starts Sage in the Windows cmd!
Proof:
So I think, the rest should be trivial. Could sb. say me, how the correct command should look like?
Note, that the problem is not my file *.sage, but to set the home directory for that file correctly.
Anyway, in detail:
The errors I get:
C:\WINDOWS\system32>C:\Programme\SageMath8.9\runtime\bin\bash -l C:/Programme/Sa
geMath8.9/runtime/opt/sagemath-8.9/sage 2+2
python2: can't open file '2+2': [Errno 2] No such file or directory
C:\WINDOWS\system32>C:\Programme\SageMath8.9\runtime\bin\bash -l C:/Programme/Sa
geMath8.9/runtime/opt/sagemath-8.9/sage C:/Users/ccc/Desktop/Test/SageTeX/sagebs
p01.sagetex.sage
Traceback (most recent call last):
File "/opt/sagemath-8.9/src/bin/sage-preparse", line 299, in <module>
do_preparse(f)
File "/opt/sagemath-8.9/src/bin/sage-preparse", line 147, in do_preparse
with atomic_write(fname) as f:
File "/opt/sagemath-8.9/local/lib/python2.7/site-packages/sage/misc/temporary_
file.py", line 422, in __enter__
fd, name = tempfile.mkstemp(dir=self.tmpdir)
File "/opt/sagemath-8.9/local/lib/python2.7/tempfile.py", line 314, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/opt/sagemath-8.9/local/lib/python2.7/tempfile.py", line 244, in _mkstem
p_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 2] No such file or directory: '/home/sage/Desktop/Test/SageTeX;/
C:/Users/ccc/Desktop/Test/SageTeX/tmpnnGeqR'
The sage-example (from the standard sagtex-example) I use:
## -*- encoding: utf-8 -*-
## This file (sagebsp01.sagetex.sage) was *autogenerated* from sagebsp01.tex with sagetex.sty version 2019/01/09 v3.3.
import sagetex
_st_ = sagetex.SageTeXProcessor('sagebsp01', version='2019/01/09 v3.3', version_check=True)
try:
_st_.current_tex_line = 11
_st_.inline(0, latex(number_of_partitions(1269)))
except:
_st_.goboom(11)
_st_.current_tex_line = 17
_st_.blockbegin()
try:
f(x) = exp(x) * sin(2*x)
except:
_st_.goboom(19)
_st_.blockend()
try:
_st_.current_tex_line = 24
_st_.inline(1, latex(f(x)))
except:
_st_.goboom(24)
try:
_st_.current_tex_line = 25
_st_.inline(2, latex(diff(f, x, 2)(x)))
except:
_st_.goboom(25)
try:
_st_.current_tex_line = 30
_st_.plot(0, format='notprovided', _p_=plot(f, -1, 1))
except:
_st_.goboom(30)
try:
_st_.current_tex_line = 33
_st_.inline(3, latex(2^123))
except:
_st_.goboom(33)
_st_.endofdoc()
"several errors"; please post (a link to) the full output, and the contents of
sagebsp01.sagetex.sage
.@rburing Done. But the file is not the problem. The problem is to run that file....
Out of curiosity why do you want to do this? Sage is a UNIX-based program and not really designed to work well in the Windows cmd shell, as you can tell from the ugly colors alone. I also can't promise that various things like keyboard commands will work well. Is there some other underlying goal? If so, perhaps there is a better way to achieve that goal.