Changes between Initial Version and Version 1 of Ticket #13750


Ignore:
Timestamp:
06/12/2010 06:26:10 PM (5 years ago)
Author:
Alex
Comment:

Reformatted description. Next time please use preview and consult WikiFormatting.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13750

    • Property Needs documentation unset
    • Property Needs tests unset
    • Property Patch needs improvement unset
  • Ticket #13750 – Description

    initial v1  
    11If you have a simple model with an ImageField, the following code will fail with a "I/O operation on closed file":
    2 
     2{{{
    33instance = MyClass.objects.get(...)
    44w = instance.image.width
    55h = instance.image.height
    66original = Image.open(instance.image)
    7 
     7}}}
    88The work around is to reopen the file:
    9 
     9{{{
    1010instance = MyClass.objects.get(...)
    1111w = instance.image.width
     
    1313instance.image.open()
    1414original = Image.open(instance.image)
    15 
     15}}}
    1616Note this is different than the issue of the 2nd read() returning empty strings for two reasons:
    1717
    18181. You can not seek(0), the file is closed.
     19
    19202. Needing to reopen in this case is unexpected.
Back to Top