From 3e1d9b17a42ea66e2be3d89d189072f24fd0e223 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Thu, 7 Sep 2017 10:36:19 +0200 Subject: [PATCH] zulip_bots: Import imp.load_source for Python < 3.5. --- zulip_bots/zulip_bots/run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zulip_bots/zulip_bots/run.py b/zulip_bots/zulip_bots/run.py index 55dd80a..876f31c 100755 --- a/zulip_bots/zulip_bots/run.py +++ b/zulip_bots/zulip_bots/run.py @@ -10,8 +10,6 @@ from types import ModuleType from importlib import import_module from os.path import basename, splitext -import six - from zulip_bots.lib import run_message_handler_for_bot from zulip_bots.provision import provision_bot @@ -21,7 +19,9 @@ def import_module_from_source(path, name=None): if not name: name = splitext(basename(path))[0] - if six.PY2: + # importlib.util.module_from_spec is supported from Python3.5 + py_version = sys.version_info + if py_version.major < 3 or (py_version.major == 3 and py_version.minor < 5): import imp module = imp.load_source(name, path) else: