oTree-org / oTree

Python framework for multiplayer decision games, behavioral experiments, and surveys
https://groups.google.com/g/otree
Other
464 stars 199 forks source link

player.in_round() does not work with numpy datatypes in otree 5 #98

Open js-frey opened 3 years ago

js-frey commented 3 years ago

in oTree 5 the player.in_round() funktion does not work with numpy interger datatypes.

For istance the following code leads to an error "Failed to create session: No corresponding Player found with round_number=1"

def creating_session(subsession: Subsession):
    for p in subsession.get_players():
        p.in_round(np.int64(1))

I tested the equivalent function in otree 3 and there it works with no issues.

While this is not a big issue since one can always convert to standart python integers, the error message here is not very helpful which makes it hard to debug.

EDIT: numpy datatypes seem to cause issues in other situations as well. For instance storing numpy integers in an IntegerField does not seem to work as it should