InMemoryUploadedFile object retrieved from request.FILES got closed automatically on django 1.7

2014-12-15 Thread Hong Yi
Hello, I am new to Django and have implemented two views and their corresponding template pages and they are working well in Django 1.6. However, when migrating to Django 1.7, I got an error "I/O operation on closed file" when getting to the second view function. I found out the root cause for

Re: InMemoryUploadedFile object retrieved from request.FILES got closed automatically on django 1.7

2014-12-15 Thread Russell Keith-Magee
On Tue, Dec 16, 2014 at 4:53 AM, Hong Yi wrote: > Hello, > > I am new to Django and have implemented two views and their corresponding > template pages and they are working well in Django 1.6. However, when > migrating to Django 1.7, I got an error "I/O operation on closed file" when > getting to

Re: InMemoryUploadedFile object retrieved from request.FILES got closed automatically on django 1.7

2014-12-16 Thread Hong Yi
Many thanks for the detailed explanation, Russ! Really appreciate it. Now I understand much better why django 1.7 enforces this. I will follow your advice to re-structure my code to make it work on django 1.7. Best regards, Hong On Monday, December 15, 2014 6:55:04 PM UTC-5, Russell Keith-Magee

Re: InMemoryUploadedFile object retrieved from request.FILES got closed automatically on django 1.7

2015-05-27 Thread Lin Cai
Russ, I have a view which create a new thread to process files user uploaded. I found either InMemoryUploadedFile or TempUploaedFile is closed in the new thread. I think that might be caused by the exit of the view thread. Do you have any idea how to re-open the closed UploadedFile or clone one