oTree icon indicating copy to clipboard operation
oTree copied to clipboard

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

Open js-frey opened this issue 4 years ago • 0 comments

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

js-frey avatar Jun 10 '21 17:06 js-frey