Python - saving context

I need to save the context of the program before exiting ... I put all the necessary things on the object that I created earlier, I tried many times to pick it up, but nothing! I keep getting errors like:

  • PicklingError: Unable to expand object 'SRE_Match': <_sre.SRE_Match object at 0x2a969cd9c0>

  • OSError: [Errno 1] Operation not allowed: [the file I link to is rwx for everyone]

the code i am using:

f = open ("/xxxx/yyyy/toto/titi/important_stuff//impo/tmp/contest.obj", 'w').close()
os.chmod("/xxxx/yyyy/toto/titi/important_stuff//impo/tmp/contest.obj", 0777)
f = open ("/xxxx/yyyy/toto/titi/important_stuff//impo/tmp/contest.obj", 'w')
pickle.dump(useCaseList, f)

      

Does anyone know how I can solve these problems or is there another solution?

Thanks in advance

0


a source to share


1 answer


See python doc What can be pickled and sprinkled . You have objects that cannot be pickled.



+3


a source







All Articles