Saving recursive objects to disc. cPickle wan't work.
Alex Polite
m4 at polite.se
Thu May 27 16:40:36 EDT 2004
On ons, maj 26, 2004 at 04:34:00 +0200, Lutz Horn wrote:
> Hm, the documentation of Python 2.3.2, Section 3.14.1 "Relationship to
> other Python modules" states that recursive objects, which are defined
> as "objects that contain references to themselves" can't be handled by
> marshal, but that pickle and cPickle should be fine: "pickle stores
> such objects only once, and ensures that all other references point to
> the master copy".
>
> What exactly are your problems?
That sound promising.
I'm building a library to generate markov models from text, much like
dadadodo.
You can get the code here.
http://snippsnapp.polite.se/wiki.pl?PyDodo
When I run my testsuit that tries to pickle a generated markov model I
get this:
python test/basicsuite.py
1000
E
======================================================================
ERROR: test_pickle (__main__.BasicTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/basicsuite.py", line 73, in test_pickle
print sys.settrecursionlimit(4000)
AttributeError: 'module' object has no attribute 'settrecursionlimit'
----------------------------------------------------------------------
Ran 1 test in 0.002s
If I up the recusionlimit the testsuit will segfault.
alex
--
Alex Polite
http://polite.se
More information about the Python-list
mailing list