oTree Forum >

Issue with "is_dropout"

#1 by roddboaten

Hi,

I get the following error when running my local server.

Failed to create session: Participant has no field "is_dropout".
...
AttributeError: Participant has no field "is_dropout".

Here is from my settings.py

PARTICIPANT_FIELDS = ['is_dropout']

Here is from my models page:

class Subsession(BaseSubsession):
    def creating_session(self):
            for p in self.get_players():
            participant = p.participant
            participant.is_dropout = 0
            
Anybody who has an idea of what the issue is? I run otree version 3.2.7.

Thanks
Daniel

#2 by Daniel_Frey

You either need to define a Participant field in settings.py (see here for background: https://otree.readthedocs.io/en/latest/rounds.html#vars)

Or you can change the variable to participant.vars['is_dropout'] = 0

#3 by Daniel_Frey

I'm sorry, I did not read your full code, you already did that.

I believe participant_fields only works in oTree 5 and beyond, therefore you either need to update your oTree-Version, or use participant.vars['is_dropout']

Best,
Daniel

Write a reply

Set forum username