Handle missing ModuleNotFoundError in py3.5
This commit is contained in:
parent
f23f107b33
commit
57280d5bef
2 changed files with 7 additions and 1 deletions
|
|
@ -333,7 +333,7 @@ class LanguageHandler(DefaultScript):
|
||||||
new_word = ''
|
new_word = ''
|
||||||
else:
|
else:
|
||||||
# use random word length
|
# use random word length
|
||||||
wlen = choice(grammar.keys())
|
wlen = choice(list(grammar.keys()))
|
||||||
|
|
||||||
if wlen:
|
if wlen:
|
||||||
structure = choice(grammar[wlen])
|
structure = choice(grammar[wlen])
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,12 @@ _EVENNIA_DIR = settings.EVENNIA_DIR
|
||||||
_GAME_DIR = settings.GAME_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
|
ENCODINGS = settings.ENCODINGS
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
_SA = object.__setattr__
|
_SA = object.__setattr__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue