# how to sage a .sage file

I am having sage installed on a windows 10. Sage file example.sage.sage which is generated by sagetex is situated in K:\sageexample folder. How to run sage on this file. All references are full of jargonism and don't explain anything at all or give examples. I run sage shell and prompt: run ('K:sageexample\example.sage.sage') but no result. I run load command load ('K:sageexample\example.sage.sage') no example. I don't want to install linux for one program. How to "sage" a file from notebook interface?

edit retag close merge delete

1

How did you install Sage ? On Windows, there are currently two possibilities :

• installing the Sage virtual appliance (= a Linux virtual machine) and running it in Virtualbox.

• Installing Erik Bray's installer (which creates a minimal Cygwin tree).

Both of these are mainly oriented to the interactive use of Sage from either a Jupyter worksheet or a "Sage console". Running Sage from the command line to compile example.sagetex.sage is a third (marginal) case, for which you need to be at a terminal :

• A Linux terminal in the first case

• A Cygwin terminal in the second case.

So tell us how you did install Sage...

( 2018-03-17 04:27:13 -0500 )edit

Sort by » oldest newest most voted

Assuming that you installed the Windows native version of Sage, run the "SageMath Shell" which opens a command-prompt, and run

sage 'K:\sageexample\example.sage.sage'


at the prompt (for example, based on the filename in the question). Note that this a a bash (Unix-like) shell, where the backslashes used in Windows paths imply an escape character normally, which might have been your problem. So it's necessary to enclose the path in single-quotes for it to be interpreted correctly.

Alternatively you can use forwardslashes instead of backslashes like

sage K:/sageexample/example.sage.sage


This will be interpreted correctly as a Windows path as long at it starts with a valid drive letter.

more

On windows, open Sagemath shell and navigate to the folder where your file is placed. You should use "cd" command. Be carefull with folders with spaces. In that case write folder name between ' '

tu process the file you should write load('file.sage') (file is the name of your file)

more