A question of using pickle on CPX

I tried to use pickle module in Python 2.4 library to store dictionary to a file for a data storage. However, I got problem when I read it back my pickle. I got the error message from the CPX.

Traceback (most recent call last):
File “./threading.py”, line 442, in __bootstrap
File “src\devices\abc.py”, line 327, in run
File “src\devices\abc.py”, line 249, in read_log
File “C:\Python24\Lib\pickle.py”, line 1390, in load
File “C:\Python24\Lib\pickle.py”, line 872, in load
File “C:\Python24\Lib\pickle.py”, line 985, in load_string
LookupError: unknown encoding: string-escape

I know that the default make.py doesn’t include the pickle.py and encodings\string_escape.py. So, I modified the make.py to complie these two files into dia.zip.

os.path.join(PYTHON_LIB, “encodings/ascii.py”),
os.path.join(PYTHON_LIB, “encodings/utf_8.py”),
os.path.join(PYTHON_LIB, “encodings/string_escape.py”),
os.path.join(PYTHON_LIB, “pickle.py”),





However, I still found a lookup problem “LookupError: unknown encoding: string-escape”. Could you tell me what the problem is?


Try packing it into Dia at the toplevel instead of inside the “encodings” directory.

For myself, I ended up doing this extra command after building dia (under Linux):

zip bin/dia.zip -j /usr/lib/python2.4/encodings/string_escape.pyc

Hi Scottk,

Thanks for your suggestion and you gave me an idea. I modified the code of “dia.py” and modified two statements in there.

sys.path.insert(0, os.path.join(DIGI_DIA_ARCHIVE, “encodings”))

for path in [‘./lib’, ‘./src’,‘./encodings’]:

It works after I changed the code and I think that it is related to the path issue.

Thanks for help :slight_smile: