From c68d690f7e10f7eb7ea16edf7f448652e8a3152e Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 13 Oct 2018 20:47:25 +0200 Subject: [PATCH] Handle missing ModuleNotFoundError in py3.5 --- evennia/contrib/rplanguage.py | 2 +- evennia/utils/utils.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/evennia/contrib/rplanguage.py b/evennia/contrib/rplanguage.py index 037b959741..aea87bf450 100644 --- a/evennia/contrib/rplanguage.py +++ b/evennia/contrib/rplanguage.py @@ -333,7 +333,7 @@ class LanguageHandler(DefaultScript): new_word = '' else: # use random word length - wlen = choice(grammar.keys()) + wlen = choice(list(grammar.keys())) if wlen: structure = choice(grammar[wlen]) diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index c83a1a0a5a..410d32e66f 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -34,6 +34,12 @@ _EVENNIA_DIR = settings.EVENNIA_DIR _GAME_DIR = settings.GAME_DIR +# ModuleNotFoundError only in py3.6, handle both +try: + from builtins import ModuleNotFoundError +except ImportError: + ModuleNotFoundError = ImportError + ENCODINGS = settings.ENCODINGS _GA = object.__getattribute__ _SA = object.__setattr__