On Sun, Jul 26, 2009 at 10:28 PM, Jacob Kaplan-Moss<ja...@jacobian.org> wrote: > > 2009/7/24 Rusty Greer <gr...@greer.org>: >> that bug actually doesn't fix my case. if i alter the patch to just >> do a file.close() in all cases, it works. is there another patch to >> close the file opened outside of this class? > > I'm not sure I follow; let me make sure I understand you: > > * You've verified that you're still having problems when running under > Django 1.1 RC 1? > > * If you're opening the image file yourself, you need to make sure you > also close it. Django can't "guess" whether you want to leave the > image open or not, so you'll need to make sure any files you open are > closed. > > Jacob >
it does appear to be fixed in 1.1 RC 1, i am not opening the file myself i have a model with an image as you stated before: > class Image(models.Model): > image = models.ImageField(upload_to=upload_to('images'), db_index=True) > height = models.IntegerField() > width = models.IntegerField() > def save(self, force_insert=False, force_update=False): > # The following is sudo code, I have no experience with image > objects > self.height = self.image.height > self.width = self.image.width > super(Image, self).save(force_insert, force_update) # Call the > "real" save() method. i applied the patch you mentioned before (to my 1.0.2 release): > Yes, it was #8817 (http://code.djangoproject.com/ticket/8817) which > was fixed a few months ago > (http://code.djangoproject.com/changeset/10708). after doing this, i am still getting the too many files open error. i am not opening the file, it is getting opened in the line "self.height = self.image.height", change 10708 does not cause the file to be closed in this case. i couldn't trace the code the entire way, but a file object is being passed into get_image_dimensions in this case, not a path, so the file is not getting opened in this function, therefore not getting closed in there either. my question is as follows: is there another patch that i can apply to 1.0.2 to fix this problem? thanks for all of your help, rusty --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---