#1
by
AndreL
I have a list of within-subject treatments inside SESSION_CONFIGS that is treat_within=('small_low', 'small_high', 'large_low', 'large_high') Then, in the main task app, under creating_session(subsession), I retrieve this list as def creating_session(subsession: Subsession): if subsession.round_number == 1: for sbj in subsession.get_players(): sbj.participant.within_seq = sbj.session.config['treat_within'] Everything works fine as above, and I get 'paricipant.within_seq' var exported from my data file if I try it. However, If I try to then shuffle this order with random.shuffle(sbj.participant.within_seq) ... I get the following error message below. Is there anything I am missing here? --------------------ERROR MESSAGE----------------------------------------------------- Failed to create session: 'tuple' object does not support item assignment Traceback (most recent call last): File "C:\Users\s13514\Dropbox\otree\SNF3_liquidity\venv\lib\site-packages\otree\session.py", line 447, in create_session_traceback_wrapper return create_session(**kwargs) File "C:\Users\s13514\Dropbox\otree\SNF3_liquidity\venv\lib\site-packages\otree\session.py", line 418, in create_session func(subsession) File "C:\Users\s13514\Dropbox\otree\SNF3_liquidity\instruct\__init__.py", line 85, in creating_session random.shuffle(sbj.participant.within_seq) File "C:\Users\s13514.FIN-70492\AppData\Local\Programs\Python\Python310\lib\random.py", line 394, in shuffle x[i], x[j] = x[j], x[i] TypeError: 'tuple' object does not support item assignment
#2
by
Chris_oTree
Change this: sbj.participant.within_seq = sbj.session.config['treat_within'] To this: sbj.participant.within_seq = list(sbj.session.config['treat_within'])