Thomas Ligon
unread,Jan 28, 2023, 11:38:46 AM1/28/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
Should pickle work for Function and Derivative? I found Sympy issue #4297 and the answer seems to be no.
Nevertheless, here is what I have:
I have a private dictionary containing expressions of symbols, and everything works fine.
Then I created a new private dictionary that includes Function and Derivative, and I can't pickle it. Here are some code snippets:
q1S, q2S = symbols('q1, q2')
q1F = Function('q1')
...
varX = globals()['CuspData']
fileName = os.path.join(config.pickle_dir, 'CuspData.pckl')
f = open(fileName, "wb")
varX = {'q1d0': q1F(tS), 'q1d1': Derivative(q1F(tS), tS)} # test
#with evaluate(False): pickle.dump(varX, f)
pickle.dump(varX, f)
f.close()
The error is "Can't pickle q1: attribute lookup q1 on __main__ failed"