Changes between Initial Version and Version 1 of Ticket #13750


Ignore:
Timestamp:
Jun 12, 2010, 6:26:10 PM (14 years ago)
Author:
Alex Gaynor
Comment:

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

Legend:

Unmodified
Added
Removed
Modified
  • 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