Ask Your Question

Keeping sage worksheets in sync across computers

asked 2012-11-23 18:18:02 -0500

marco gravatar image

I have been using Sage through the notebook interface. I usually keep my other working documents in sync using Dropbox. What do you think is an efficient way of working on notebooks from different computers? Currently I export and import .sws files. I thought of perhaps changing the DATA path to a folder on Dropbox, but I don't know enough about the internals of Sage to see if this would be a horrible idea.

edit retag flag offensive close merge delete



I think this is a duplicate of The accepted answer there is to set `DOT_SAGENB` to point to the directory containing your notebook data.

John Palmieri gravatar imageJohn Palmieri ( 2012-11-24 07:50:16 -0500 )edit

I hate to own up to just how little I understand about IT, but I have tried to follow your instructions on adding a line to the .profile file; only "locate" in BASH cannot find any file with that name on my drive. I know I'm being dumb, sorry, but how do I find it and edit it please?

GaryMak gravatar imageGaryMak ( 2013-02-21 10:10:25 -0500 )edit

Do you have a file called ".bash_profile" or ".bashrc" in your home directory? You can add the appropriate line (`export DOT_SAGENB=...`) to either of those files instead.

John Palmieri gravatar imageJohn Palmieri ( 2013-02-21 17:01:19 -0500 )edit

thank you, and sorry for my continuing ineptitude ... the only 2 things I can find anywhere on my computer with .bash in them are these: /Users/<myname>/.bash_history and /usr/share/emacs/22.1/etc/emacs.bash which presumably are not what we want ...

GaryMak gravatar imageGaryMak ( 2013-02-21 22:51:03 -0500 )edit

So create any of the files I mentioned, say ".bashrc", and add the appropriate line to that file.

John Palmieri gravatar imageJohn Palmieri ( 2013-02-22 07:17:04 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2012-11-24 05:33:34 -0500

marco gravatar image

One thing that seems to work is to start the sage notebook from the terminal session with

sage: notebook('/Users/.../Dropbox/Sage')

to create a notebook in the specified directory and then use the same command for any other linked computer. I've tried this out and it seems to work perfectly using Dropbox.

edit flag offensive delete link more


Try creating some new worksheets and/or users on the original machine. If it syncs properly and you get the exact same worksheets on the other machine, then you are good. I still think that using Dropbox for syncing might backfire some day.

ppurka gravatar imageppurka ( 2012-11-24 18:20:34 -0500 )edit

As I've noted, you should use the environment variable `DOT_SAGENB` to point to the notebook directory (e.g., put `export DOT_SAGENB=/Users/.../Dropbox/Sage` in your .profile file if you're using bash).

John Palmieri gravatar imageJohn Palmieri ( 2012-11-25 04:03:39 -0500 )edit

thanks, that makes it even easier.

marco gravatar imagemarco ( 2012-11-27 17:20:38 -0500 )edit

answered 2012-11-23 20:52:01 -0500

ppurka gravatar image

One way would be to keep $HOME/.sage/sage_notebook.sagenb in sync. But not through dropbox. Dropbox doesn't care about symbolic links, whereas that sagenb directory is full of symbolic links. You could instead use something like unison.

edit flag offensive delete link more


What do you mean by "Dropbox doesn't care about symbolic links"?

John Palmieri gravatar imageJohn Palmieri ( 2012-11-24 07:53:59 -0500 )edit

Try this: on one machine, create a symbolic link to any file and allow Dropbox to sync. On the second machine you will actually see a *copy* of the symbolic link and not the symbolic link itself. This is a super useful feature because it allows you to have your content not confined to the Dropbox folder that is being synchronized. However, this is not good for the notebook directory because that directory needs the symlinks, and not just copies of directories.

ppurka gravatar imageppurka ( 2012-11-24 18:15:39 -0500 )edit

I think that the notebook directory only has symlinks to other files in the notebook directory, and in my experience, it respects these kind of links. So if the whole notebook directory is under the control of Dropbox, there is no problem. That is, try setting DOT_SAGENB to something like `Dropbox/.sagenb/`.

John Palmieri gravatar imageJohn Palmieri ( 2012-11-25 04:00:40 -0500 )edit

I've been using Dropbox via the settings that @John Palmieri recommended for several months on several different machines and haven't had any trouble.

calc314 gravatar imagecalc314 ( 2012-11-25 09:19:10 -0500 )edit

Apparently the solution of setting DOT_SAGENB to a directory inside Dropbox works fine. Thank you! I have tried moving .sage to Dropbox and replacing .sage by a symlink, and for some reason it fails badly. Also I tried creating a symlink inside .sage called sage_notebook.sagenb pointing to a directory inside Dropbox and that also failed.

user3353 gravatar imageuser3353 ( 2014-10-31 08:26:03 -0500 )edit

answered 2013-03-24 03:24:00 -0500

sjcavazos2 gravatar image

What about rsync over ssh? Has anyone tried that out?

edit flag offensive delete link more

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: 2012-11-23 18:18:02 -0500

Seen: 787 times

Last updated: Mar 24 '13