Ask Your Question

Revision history [back]

It sounds like you might do better by just updating the worksheet source files.

All of the worksheet data is in ~/.sage/sage_notebook.sagenb/home/admin (unless you chose a different user name for your sage notebook, in which case the last directory will be that user name). In there the directories are numbered -- I think in the order than the worksheets were created. Inside each there is a file named worksheet_conf.pickle and another one named worksheet.html. There are also directories named cells, data, snapshots.

Although it has a promising name, the data directory is empty for all of my worksheets (which are certainly not empty).

The pickle file stores a dictionary with some basic information about the worksheet. In particular, the worksheet name is there. But the data of what's in each cell does not seem to be there. The html file does have the input data for each cell. I tried editing this file, and the change appeared when I opened the worksheet in sage. I don't know if this is a good way to do it, but I didn't see data stored elsewhere. (Except, possibly, in the snapshots directory, which I'm assuming is for backup.) I guess your task doesn't require changing the worksheet input anyway though. But you could write a script to collect all of those input cells, for use later.

The cells directory seems to hold the output of all cells. In your case, you might delete the contents of all those directories to clear the output. Did I mention you should make a backup of your sage_notebook.sagenb directory first? Definitely do :)

To re-evaluate all cells, you could write a sage script to take the input (collected from worksheet.html) for each cell, evaluate it, and store the result in the corresponding directory.


By the way, do you have some other strong reason to be tied to the notebook? Once you're writing a sage script to evaluate a series of commands and store the results, you could store them anywhere you like, in any format you like.