GUI interface: fix resource warning

This commit is contained in:
André Apitzsch 2017-12-18 23:14:22 +01:00
parent 01d535527e
commit f3bde561a3
1 changed files with 3 additions and 1 deletions

View File

@ -2443,7 +2443,9 @@ class Interface:
'loading avatar %s failed. Try to convert '
'avatar image using pillow', filename)
try:
avatar = Image.open(path).convert("RGBA")
with open(path, 'rb') as im_handle:
img = Image.open(im_handle)
avatar = img.convert("RGBA")
except (NameError, OSError):
app.log('avatar').warning('Pillow convert failed: %s', filename)
app.log('avatar').debug('Error', exc_info=True)