[Biopython] SeqRecords and multiprocessing
Peter Cock
p.j.a.cock at googlemail.com
Fri Apr 22 17:25:29 UTC 2011
On Fri, Apr 22, 2011 at 6:03 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>
> Is the problem that _RestrictedDict isn't pickle-able?
>
This seems to work fine:
>>> from Bio.SeqRecord import _RestrictedDict as RD
>>> import pickle
>>> x = RD(5)
>>> x["test"] = "hello"
>>> x
{'test': 'hello'}
>>> y = pickle.loads(pickle.dumps(x))
>>> y
{'test': 'hello'}
>>> y._length
5
I guessed it was down to the protocol...
>>> y = pickle.loads(pickle.dumps(x,0))
>>> y
{'test': 'hello'}
>>> y = pickle.loads(pickle.dumps(x,1))
>>> y
{'test': 'hello'}
And suddenly:
>>> y = pickle.loads(pickle.dumps(x,2))
Traceback (most recent call last):
...
AttributeError: '_RestrictedDict' object has no attribute '_length'
Progress.
Peter
More information about the Biopython
mailing list