Lykanz when you switched to the 8.x branch of Ren'Py, you forgot to ports some parts of your code:
Code:
File "game/script.rpy", line 153, in cur_period
if self.period in self.PERIODS.keys()[2]:
TypeError: 'dict_keys' object is not subscriptable
In Python 3.x the dictionnaries'
keys
method do not return a
list, but a
dict_keys object. Such objects don't have the
__getitem__
meta method needed to address them by indexation, like you were doing with the versions of Ren'Py that were still relying on Python 2.x. Since
dict_keys are iterable views, you can still use the
keys
method in most of the case, except this one.
Strictly speaking, what you should use is
list( self.PERIODS.keys() )[2]
.
But this would only solve the TypeError issue. Dictionaries are unordered, therefore addressing a key by its index is useless and prone to changes ; you don't have the guaranty that the key will be the one you expect.