Changes between Initial Version and Version 1 of Ticket #13750
- Timestamp:
- Jun 12, 2010, 6:26:10 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13750 – Description
initial v1 1 1 If you have a simple model with an ImageField, the following code will fail with a "I/O operation on closed file": 2 2 {{{ 3 3 instance = MyClass.objects.get(...) 4 4 w = instance.image.width 5 5 h = instance.image.height 6 6 original = Image.open(instance.image) 7 7 }}} 8 8 The work around is to reopen the file: 9 9 {{{ 10 10 instance = MyClass.objects.get(...) 11 11 w = instance.image.width … … 13 13 instance.image.open() 14 14 original = Image.open(instance.image) 15 15 }}} 16 16 Note this is different than the issue of the 2nd read() returning empty strings for two reasons: 17 17 18 18 1. You can not seek(0), the file is closed. 19 19 20 2. Needing to reopen in this case is unexpected.