python: why a File object cannot be pickled?
Python does not allow pickling of some functions either, because of security problems if it were to be allowed. (It depends - there are ways to pickle some functions by reference)
Pickling file objects has been requested in the features threads of python many times, and the best reasoning is because it opens up additional hack vectors into the security processes of python, by allowing run-time injections of potentially malicious events.
It would be very convenient to have in a number of ways, but it appears to be a security restriction.
I am trying to understand why sending a django InMemoryUploadedFile object cannot be pickled when sending it as an argument of a celery task, Can't pickle <type 'cStringIO.StringO'>: attribute lookup cStringIO.StringO failed. So i tried out the File object, doesn't work as well, but a StringIO would work.
Need some dummies' guidance in understanding the difference between the 3.
thanks!