I/O operation on closed file

301 views
Skip to first unread message

Tim Sawyer

unread,
May 12, 2009, 4:27:08 PM5/12/09
to django...@googlegroups.com
Hi,

I'm getting the following error uploading images to my gallery using the admin
site, written in django (full stack at bottom of mail)

ValueError: I/O operation on closed file

It doesn't always happen, and it;s more likely to occur using "Save but keep
editing" in the admin.

I'm using svn 10712.

Any clues?

Thanks,

Tim.

File "/home/mybandsite/django-trunk/django/core/handlers/base.py", line 92,
in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/home/mybandsite/django-trunk/django/contrib/admin/sites.py", line
480, in root
return self.model_page(request, *url.split('/', 2))

File "/home/mybandsite/django-trunk/django/views/decorators/cache.py", line
44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

File "/home/mybandsite/django-trunk/django/contrib/admin/sites.py", line
499, in model_page
return admin_obj(request, rest_of_url)

File "/home/mybandsite/src/MyBandSite/admin.py", line 113, in __call__
return super(SiteOnlyAdmin, self).__call__(request, url)

File "/home/mybandsite/django-trunk/django/contrib/admin/options.py", line
1094, in __call__
return self.change_view(request, unquote(url))

File "/home/mybandsite/django-trunk/django/db/transaction.py", line 240, in
_commit_on_success
res = func(*args, **kw)

File "/home/mybandsite/django-trunk/django/contrib/admin/options.py", line
832, in change_view
self.save_formset(request, form, formset, change=True)

File "/home/mybandsite/src/MyBandSite/admin.py", line 82, in save_formset
formset.save()

File "/home/mybandsite/django-trunk/django/forms/models.py", line 509, in
save
return self.save_existing_objects(commit) + self.save_new_objects(commit)

File "/home/mybandsite/django-trunk/django/forms/models.py", line 643, in
save_new_objects
self.new_objects.append(self.save_new(form, commit=commit))

File "/home/mybandsite/django-trunk/django/forms/models.py", line 738, in
save_new
obj.save()

File "/home/mybandsite/src/MyBandSite/gallery/models.py", line 61, in save
super(GalleryImage, self).save()

File "/home/mybandsite/django-trunk/django/db/models/base.py", line 407, in
save
self.save_base(force_insert=force_insert, force_update=force_update)

File "/home/mybandsite/django-trunk/django/db/models/base.py", line 461, in
save_base
values = [(f, None, (raw and getattr(self, f.attname) or f.pre_save(self,
False))) for f in non_pks]

File "/home/mybandsite/django-trunk/django/db/models/fields/files.py", line
191, in pre_save
file.save(file.name, file, save=False)

File "/home/mybandsite/django-trunk/django/db/models/fields/files.py", line
239, in save
self._dimensions_cache = get_image_dimensions(content)

File "/home/mybandsite/django-trunk/django/core/files/images.py", line 39, in
get_image_dimensions
data = file.read(1024)

File "/home/mybandsite/django-trunk/django/core/files/uploadedfile.py", line
87, in read
def read(self, *args): return self._file.read(*args)

ValueError: I/O operation on closed file

Alex Gaynor

unread,
May 12, 2009, 4:28:35 PM5/12/09
to django...@googlegroups.com
This is probably a symptom of http://code.djangoproject.com/ticket/11084 .

Alex

--
"I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire
"The people's good is the highest law."--Cicero

Tim Sawyer

unread,
May 14, 2009, 4:45:50 PM5/14/09
to django...@googlegroups.com
On Tuesday 12 May 2009 21:28:35 Alex Gaynor wrote:

> On Tue, May 12, 2009 at 3:27 PM, Tim Sawyer wrote:
> > ValueError: I/O operation on closed file
>
> This is probably a symptom of http://code.djangoproject.com/ticket/11084 .
>

Thanks Alex.

I've just updated to 10784 (without a fix for that bug) and it seems fine now!

Cheers,

Tim.

Reply all
Reply to author
Forward
0 new messages