[PythonCE] pickle problem on 2.3.4 pythonCE (for wxPython)

Matt S. sleepingbull at gmail.com
Fri May 26 21:47:10 CEST 2006


I'm trying to make a data collection UI for Windows CE using the
wxPyCE distribution (which uses Python 2.3.4)  found at,


It's gone well so far but I'm running into a serious data pickling
problem.  Ideally I would like to pickle a class instance.

Saving and loading the pickled class works fine on my PC (Python 2.4x),

 f = open('pickle_file.pyp', 'r')
pickle.dump(my_class_instance, f)

f = open('saved_pickle.pyp', 'r')
my_pickled_class_instance = pickle.load(f)

In my UI module the pickling are methods in a class.  Also, "my_class"
is actually, "another_module.top_level_class.data," wherein ".data" is
a dictionary with keys that are person names and values that are the
corresponding person instance.

Realizing that I'm probably breaking the pickling rules with pickling
my data class, I changed "my_class" in *pickleDump.py* to a simple
dictionary...  and it still failed on CE.  Fortunately, simplifying my
data to a simple list does pickle.  So, in the worst case I can
convert my data into lists (not pretty so if you have a better
workaround idea I'd really appreciate it).

Here's the traceback from my attempt to load the pickled dictionary,

Traceback (most recent call last):
  File "\Program Files\python\dev\pickleLoad.py", line 10, in ?
    var = pickle.load(f)
  File "binaries\lib\pickle.py", line 1390, in load
  File "binaries\lib\pickle.py", line 872, in load
  File "binaries\lib\pickle.py", line 985, in load_string
LookupError: no codec search functions registered: can't find encoding

Here are my test modules,


import pickle, traceback, sys

f = open('test.txt','w')
error = open('dump_error.txt','w')
sys.stderr = error
log = open('dump_out.txt','w')
sys.stdout = log

#var = [n for n in range(10)]
var = {'parm1':1, 'parm2':'2a'}


    print 'Pickled dumped OK in,', __file__
    print 'Pickle dump failed! in', __file__



import pickle, sys, traceback

e = open('load_error.txt','w')
sys.stderr = e
s = open('load_out.txt','w')
sys.stdout = s

    f = open('test.txt','r')
    var = pickle.load(f)
    print 'Pickle loaded OK in,', __file__
    print var

    print 'Pickle not loaded in,', __file__

Many thanks for your help,

More information about the PythonCE mailing list