From f3bde561a37dc9c4911a8dce4b3cb078e4f03070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Mon, 18 Dec 2017 23:14:22 +0100 Subject: [PATCH] GUI interface: fix resource warning --- gajim/gui_interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 492b5da69..71f849c79 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -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)