Tried to get players in subsession, keep showing error "keyword argument 'group'"

281 views
Skip to first unread message

Dong Yan

unread,
Apr 26, 2021, 4:43:46 AM4/26/21
to oTree help & discussion
Hi all

I am writing a code about whether people would like to share risk. After making sharing decisions, people are asked about their beliefs of how many player in this session agree to share. Since player will be rewarded if their guess is close to the truth, thus I define a function like below

def Correct_a (subsession:Subsession):

players =  subsession.get_players()
action_a1= [p.Share_a for p in players]
belief_a1_avg = sum(action_a1_avg) / len(players)
subsession.Correct_Belief_a1 = round(belief_a1_avg, 1)

However, when I tried this coding it always shows "error type 500:got an unexpected keyword argument 'group'" even when the variable group showing nowhere in this function.

To debug, I even tried a sample version as below

def Correct_a (subsession:Subsession):
players =  subsession.get_players()

However, the same error keeps showing. Does anyone knows what is going on here?

Best,
Dong

 


Chris @ oTree

unread,
Apr 26, 2021, 9:32:38 AM4/26/21
to oTree help & discussion
if you are using this function in after_all_players_arrive, you would need to set wait_for_all_groups = True because it is a subsession function. 
Reply all
Reply to author
Forward
0 new messages