Ask Your Question

Where is the sage save or load dir and how do I change it?

asked 2017-06-08 01:21:35 +0200

cybervigilante gravatar image

How in the heck does sage notebook (for Linux) manage files? I can't figure where it's saving them or how to load one. I tried os.getcwd() and got a temp file '/tmp/tmpJcEfeK' so I tried changing to the download directory, where it looked like an sws file was saved, with os.chdir("/home/jim/Downloads") That appeared to work since there was no error message. But then I did getcwd again and was still in the temp file. I just want to load a python script "" that's in the downloads folder but that fails. Finding where Sage actually is or changing it is a nightmare.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-06-08 03:30:08 +0200

If you do os.chdir(...) and then os.getcwd() in the same SageNB cell, you will get the expected answer. Each cell seems to set its directory separately. In any case, when you are using save, load, etc., in SageNB, then use absolute paths: save("/home/jim/.../file") rather than just save("file").

edit flag offensive delete link more

answered 2017-06-08 02:19:31 +0200

kcrisman gravatar image

updated 2017-06-08 13:56:07 +0200

There is a huge difference between what sagenb and Jupyter do here. Jupyter behaves more or less as normal for applications that save external documents to a hard drive. Sagenb was designed to remove that layer from the user, especially in server situations.

On your computer, usually in your home directory, there should be a folder called .sage. Inside of this will be the directories for various metadata, including the Sage notebook worksheets. Usually it is called sage_notebook.sagenb though sometimes people might give it other names. Here is my listing:

$ ls .sage/sage_notebook.sagenb/home/admin/
0       154     27      336     51
100     156     278     337     53
101     157     28      338     54
102     158     281     339     55
103     159     284     340     58
104     16      285     341

So as you can see each worksheet is a numbered folder in the home/admin subfolder. Other users would have other names.

Edit: Another option if you are specifically wondering about files is to use the "Data..." drop-down menu which attaches files to the worksheet itself, then you can use the DATA variable to access them.

edit flag offensive delete link more


I loaded with the absolute path load("/home/jim/Downloads/") which is supposed to run the program, but nothing happens. No error so I assume it loaded. Is there a separate run command after it loads?

cybervigilante gravatar imagecybervigilante ( 2017-06-08 04:01:20 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-06-08 01:21:35 +0200

Seen: 3,453 times

Last updated: Jun 08 '17