Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SAGE_TMP is the Sage temp directory. This will always be deleted after you quit Sage, so as the name implies you should only use it for temporary files.

You need sufficient permissions to save a file anywhere else. If you run the sage server yourself then you should be able to save files anywhere in your home directory. On sagenb.org you obviously can't write files anywhere outside of SAGE_TMP

If the data you want to store is not too long then you can just pickle them into a string:

sage: v = vector([1,2/3,4/5])
sage: v
(1, 2/3, 4/5)
sage: v.dumps()
'x\x9cu\x8f\xbbN\x031\x10E\x958\x810\x10\x1e\x7f\x01\x8d\xa3\xe5\xf1\x0biVPX\xda2\xb2\x1c\xefd\xb1\xd6\xb13~D\xa2@\xa2A\xc0_\xb3\tK*\xe8\xce-\xce\x9d;oC\x1dU\x83|\xed\xebl1\xf2-\xea\xe4\x83\x0c*\x19\xef\x94\x955\xba\x88\x90\xdd\xc6\xe8\xd6\xa2\xdc\x16@\x83\xeb\x1f%\xa6\x90u\xca\x01\xf9J\xed\xa4\x17h\xd0a0Z\xf6Y\xfej@\xc3\x7f\x1d\xeb}\x9b7\xb2\xb1~\xa9,\x10\xab`\x1e\x10\x1f\xf7sh\xf4.h\\\x8e\xcbQ\xc5\x82.>\xe8\xa8\xaf\t\xc65\x91\x1fF\xae\x0c\xda\x1aD\x1f\xe7\xfbD\xc77\x82&%\xfbzJt\xf2\x9a\x08\x04\x9d.\xe8\xec\xcf\x02X\xab\x16\x0f?\x03M\xabA\xd1]>\x7f\x9eV\xecvv\xd7\xe1\xc5\x0e\xefg\x0f\x1d^b\xc9>\x93\xa0+\xfe\rV\x95m\xe3'

Restart...

sage: loads('x\x9cu\x8f\xbbN\x031\x10E\x958\x810\x10\x1e\x7f\x01\x8d\xa3\xe5\xf1\x0biVPX\xda2\xb2\x1c\xefd\xb1\xd6\xb13~D\xa2@\xa2A\xc0_\xb3\tK*\xe8\xce-\xce\x9d;oC\x1dU\x83|\xed\xebl1\xf2-\xea\xe4\x83\x0c*\x19\xef\x94\x955\xba\x88\x90\xdd\xc6\xe8\xd6\xa2\xdc\x16@\x83\xeb\x1f%\xa6\x90u\xca\x01\xf9J\xed\xa4\x17h\xd0a0Z\xf6Y\xfej@\xc3\x7f\x1d\xeb}\x9b7\xb2\xb1~\xa9,\x10\xab`\x1e\x10\x1f\xf7sh\xf4.h\\\x8e\xcbQ\xc5\x82.>\xe8\xa8\xaf\t\xc65\x91\x1fF\xae\x0c\xda\x1aD\x1f\xe7\xfbD\xc77\x82&%\xfbzJt\xf2\x9a\x08\x04\x9d.\xe8\xec\xcf\x02X\xab\x16\x0f?\x03M\xabA\xd1]>\x7f\x9eV\xecvv\xd7\xe1\xc5\x0e\xefg\x0f\x1d^b\xc9>\x93\xa0+\xfe\rV\x95m\xe3')
(1, 2/3, 4/5)