cPickle not found as a Built-In module

How can i use cPickle on the X4 enviroment.

I have added other modules to the gate way but as cPickle is Built in i am not sure if i can add it ( there is know .py or .pyc in to copy ).

I need it as it is used in the “Logging” Module. i could look at changing the module but it would be better to get the standard module to load.

An alternative would be to save as a simple CSV or lines of text. remember, from the Web UI you can actually open/save-as the file. This probably takes less flash space.

Several of my projects have used pure binary writes which allowed 10,000 records in 100K of space, then a save-as puts the file onto a PC, where a seperate Python tool can parse the binary file.

I’m actually having the same problem. In my case the cPickle and cStringIO libraries are used by third party scripts.

Is there any way to include them on the ConnectPort or are my only options to rewrite the third party scripts?

Regards,

Hi bobshort,

cPickle will be a problem on the X4 for now, due to it being C binary. The standard library ‘pickle’ however works fine, with a limitation of unicode encoded strings. pickle supports the same dump/load operations as cPickle, but will be approximately 10 times slower on the X4.

Depending on what type of data you’re working with, you may want to add the string_escape.py library to the python.zip in the ‘encodings’ directory as well. It allows for loads of strings that use the '' operator.

However, if you are really set on cPickle, you should probably talk to some of Digi’s sale staff. They may have a solution for you, as adding a C binary for customers isn’t unheard of.

Hope this helps,
Max