Ask Your Question
2

Keeping sage worksheets in sync across computers

asked 2012-11-24 01:18:02 +0100

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

Comments

1

I think this is a duplicate of http://ask.sagemath.org/question/1576/running-sage-with-files-on-dropbox. 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 14:50:16 +0100 )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 17:10:25 +0100 )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-22 00:01:19 +0100 )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-22 05:51:03 +0100 )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 14:17:04 +0100 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2012-11-24 12:33:34 +0100

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

Comments

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-25 01:20:34 +0100 )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 11:03:39 +0100 )edit

thanks, that makes it even easier.

marco gravatar imagemarco ( 2012-11-28 00:20:38 +0100 )edit
1

answered 2012-11-24 03:52:01 +0100

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

Comments

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

John Palmieri gravatar imageJohn Palmieri ( 2012-11-24 14:53:59 +0100 )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-25 01:15:39 +0100 )edit
1

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 11:00:40 +0100 )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 16:19:10 +0100 )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 14:26:03 +0100 )edit
0

answered 2013-03-24 09:24:00 +0100

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

Stats

Asked: 2012-11-24 01:18:02 +0100

Seen: 1,840 times

Last updated: Mar 24 '13