From 3d8be9ebe2055ea1ef4d66504cf5cca377942b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 3 Jul 2017 11:32:47 +0200 Subject: [PATCH] Fix emoticons module import on windows --- gajim/emoticons.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gajim/emoticons.py b/gajim/emoticons.py index b3aaf3933..7f6abc35d 100644 --- a/gajim/emoticons.py +++ b/gajim/emoticons.py @@ -16,6 +16,7 @@ # along with this program. If not, see . import os +import sys import logging import importlib.util as imp from collections import OrderedDict @@ -58,8 +59,13 @@ class SubPixbuf: return subpixbuf def load(path): - theme_path = os.path.join(path, 'emoticons_theme.py') - spec = imp.spec_from_file_location("emoticons_theme.py", theme_path) + module_name = 'emoticons_theme.py' + theme_path = os.path.join(path, module_name) + if sys.platform == 'win32' and not os.path.exists(theme_path): + module_name = 'emoticons_theme.pyc' + theme_path = os.path.join(path, module_name) + + spec = imp.spec_from_file_location(module_name, theme_path) try: theme = imp.module_from_spec(spec) spec.loader.exec_module(theme)