Handle missing ModuleNotFoundError in py3.5

This commit is contained in:
Griatch 2018-10-13 20:47:25 +02:00
parent 8d18cce3b0
commit c68d690f7e
2 changed files with 7 additions and 1 deletions

View file

@ -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])

View file

@ -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__