1

I'm trying to put the request.session fields in my request.session for use it later. But when I simply write:

request.session['fileInfo'] = request.FILES

I always get this error:

Pickilng error: Can't pickle <type 'cStringIO.StringO'>: attribute lookup cStringIO.StringO failed

What's the problem?

David Robinson
  • 77,383
  • 16
  • 167
  • 187
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108

1 Answers1

1

The problem is sessions are transformed to strings using a standard module called pickle. pickle must be able to transform all objects in the session dict.

The request.FILES object is not pickle-able.

salezica
  • 74,081
  • 25
  • 105
  • 166
  • 1
    Your final point is not really true, the session data itself isn't stored in the cookie, just the ID. The data is in the session storage backend, which is usually the database. – Daniel Roseman Apr 02 '13 at 14:46
  • Right you are. I removed the offending sentence – salezica Apr 02 '13 at 14:48