pickling question

2009-09-02 Thread Gary Robinson
When you define a class in a script, and then pickle instances of that class in the same script and store them to disk, you can't load that pickle in another script. At least not the straightforward way [pickle.load(file('somefile.pickle'))]. If you try it, you get an AttributeError during the

Re: pickling question

2009-09-02 Thread Carl Banks
On Sep 2, 7:06 am, Gary Robinson gary...@me.com wrote: When you define a class in a script, and then pickle instances of that class in the same script and store them to disk, you can't load that pickle in another script. At least not the straightforward way

Re: pickling question

2009-09-02 Thread exarkun
On 02:06 pm, gary...@me.com wrote: When you define a class in a script, and then pickle instances of that class in the same script and store them to disk, you can't load that pickle in another script. At least not the straightforward way [pickle.load(file('somefile.pickle'))]. If you try it,

Re: pickling question

2009-09-02 Thread Gary Robinson
Many thanks for the responses I've received here to my question (below). After reading the responses, I understand what the problem is much better. In addition to the solutions mentioned in the responses, now that I understand the problem I'll offer up my own solution. The following is an