From: chuck c. <cc...@zi...> - 2002-03-13 02:36:20
|
thanks brian... on one front it was really simple...i tried import pickle and got an ImportError and I moved on to writing my own serialization not even thinking to try importing cPickle i've switched to using the cPickle code now and everything works as expected it looks like samuel has tracked down the bug...so all ends well thanks chuck ----- Original Message ----- From: "brian zimmer" <bz...@zi...> To: <cc...@zi...>; <jyt...@li...> Cc: <bu...@cu...> Sent: Tuesday, March 12, 2002 7:50 PM Subject: [Jython-users] RE: Issue with None and Serialization > Chuck, > > Why can't you assume cPickle is available? It's standard in the Jython > dist as a Java-implemented module. I have modified your example a bit > to use it and it seems to behave properly. Add the following two > methods: > > --- code --- > > import cPickle > > def load_with_pickle(path): > fp = open(path, "rb") > try: > data = cPickle.load(fp) > finally: > fp.close() > return data > > def save_with_pickle(obj, path): > fp = open(path, "wb") > try: > cPickle.dump(obj, fp) > finally: > fp.close() > |