Ask Your Question

Revision history [back]

How to save a list to a file, with sage objects in it?

Hi, I am trying to save intermediate step of my calculation into a file, so that next time I can read the file to resume the calculation. Say, I need to save

f = function('a',var('t'))
s = [f] # together with other things in the list

How to save s to a file?

I tried two ways:

(1) Standard python module pickle cannot save sage objects, thus fails

(2) I converted s to a python object:

s = Sequence([f])

Now I can use s.save('file_name'). However, there is a bug that I cannot load using load('file_name')

RuntimeError: unknown function 'a' in archive

It is a known bug: http://trac.sagemath.org/sage_trac/ticket/11919 .

Unfortunately I am not expert enough to fix that bug, and I really want to get my work done before waiting for the fix. Is there any other way to save the list s currently?

In the bug report it is mentioned that an older version of Pynac doesn't have this bug. If there is no other work around, is it possible to downgrade Pynac within sage or I have to downgrade the whole sage?

Thanks!

click to hide/show revision 2
retagged

How to save a list to a file, with sage objects in it?

Hi, I am trying to save intermediate step of my calculation into a file, so that next time I can read the file to resume the calculation. Say, I need to save

f = function('a',var('t'))
s = [f] # together with other things in the list

How to save s to a file?

I tried two ways:

(1) Standard python module pickle cannot save sage objects, thus fails

(2) I converted s to a python object:

s = Sequence([f])

Now I can use s.save('file_name'). However, there is a bug that I cannot load using load('file_name')

RuntimeError: unknown function 'a' in archive

It is a known bug: http://trac.sagemath.org/sage_trac/ticket/11919 .

Unfortunately I am not expert enough to fix that bug, and I really want to get my work done before waiting for the fix. Is there any other way to save the list s currently?

In the bug report it is mentioned that an older version of Pynac doesn't have this bug. If there is no other work around, is it possible to downgrade Pynac within sage or I have to downgrade the whole sage?

Thanks!