[Django]-Python pickling error when using sessions

4👍

It appears you have a cStringIO object in your session (perhaps an uploaded file?), these cannot be pickled. Either write custom pickling code or make sure all your session data can be serialized.

1👍

Something weird going on here, because the error refers to cStringIO.StringO whereas the class is actually cStringIO.StringIO, with an extra I. Have you misspelled the name somewhere?

1👍

In support of Ivo’s answer, here’s a reference I found which may explain this: http://bugs.python.org/issue5345

This is not a typo. cStringIO.StringIO
is a factory function that returns
either a cStringO object (for writing)
or cStringI (for reading). If this
behavior causes a problem to you, then
consider using StringIO.StringIO.

Alternatively, you could upgrade to
Python 2.7 or 3.0 and use
io.StringIO() which doesn’t have this
limitation.

Leave a comment