#1 by Yujia
I tried to randomly assign the subjects to different treatment groups with different questions. The game had multiple rounds, so I referred to the example files on the oTree hub and upgraded otree with the pip3 install -U otree command. However, when debugging locally it keeps showing the error of the title. Here is the code: def creating_session(subsession: Subsession): import itertools randoms = itertools.cycle([True, False]) if subsession.round_number == 1: for player in subsession.get_players(): participant = player.participant participant.treatment = next(randoms) if participant.treatment: participant.PAYOFFA11 = C.PAYOFF_A11u participant.PAYOFFA12 = C.PAYOFF_A12u participant.PAYOFFA21 = C.PAYOFF_A21u participant.PAYOFFA22 = C.PAYOFF_A22u participant.PAYOFFB11 = C.PAYOFF_B11u participant.PAYOFFB12 = C.PAYOFF_B12u participant.PAYOFFB21 = C.PAYOFF_B21u participant.PAYOFFB22 = C.PAYOFF_B22u participant.OtherChoice = C.OtherChoiceu else: randseed = random.random() participant.PAYOFFA11 = payoff_shuffle(C.PAYOFF_A11r, randseed) participant.PAYOFFA12 = payoff_shuffle(C.PAYOFF_A12r, randseed) participant.PAYOFFA21 = payoff_shuffle(C.PAYOFF_A21r, randseed) participant.PAYOFFA22 = payoff_shuffle(C.PAYOFF_A22r, randseed) participant.PAYOFFB11 = payoff_shuffle(C.PAYOFF_B11r, randseed) participant.PAYOFFB12 = payoff_shuffle(C.PAYOFF_B12r, randseed) participant.PAYOFFB21 = payoff_shuffle(C.PAYOFF_B21r, randseed) participant.PAYOFFB22 = payoff_shuffle(C.PAYOFF_B22r, randseed) participant.OtherChoice = payoff_shuffle(C.OtherChoicer, randseed) class Player(BasePlayer): option1 = models.BooleanField( choices=[[True, 'Option1'], [False, 'Option2']], doc="""This player's decision""", widget=widgets.RadioSelect, ) treatment = models.BooleanField() PAYOFFA11 = models.CurrencyField() PAYOFFA12 = models.CurrencyField() PAYOFFA21 = models.CurrencyField() PAYOFFA22 = models.CurrencyField() PAYOFFB11 = models.CurrencyField() PAYOFFB12 = models.CurrencyField() PAYOFFB21 = models.CurrencyField() PAYOFFB22 = models.CurrencyField() OtherChoice = models.CurrencyField() The page code: class Decision(Page): form_model = 'player' form_fields = ['option1'] def vars_for_template(self): participant = Player.participant return { 'round_number': self.round_number, 'payoffA11': participant.PAYOFF_A11[self.round_number - 1], 'payoffA12': participant.PAYOFF_A12[self.round_number - 1], 'payoffB11': participant.PAYOFF_B11[self.round_number - 1], 'payoffB12': participant.PAYOFF_B12[self.round_number - 1], 'payoffA21': participant.PAYOFF_A21[self.round_number - 1], 'payoffB21': participant.PAYOFF_B21[self.round_number - 1], 'payoffA22': participant.PAYOFF_A22[self.round_number - 1], 'payoffB22': participant.PAYOFF_B22[self.round_number - 1], 'treatment': participant.treatment } Please help!