oTree Forum >

Chat function returns error "AttributeError: 'str' object has no attribute 'id'"

#1 by Xinxin

Hi Chris,

I am running a code that used to work well but got the following error message: 

Application error (500)
AttributeError: 'str' object has no attribute 'id'
File DynamicPower_05_Experiment/P02_WaitForGroup.html, line 46, in chat

43. </div>

44.     <div class="col-6">

45. <div class="card-body">

46. {{ chat }}

47. </div>

48.    

49.  </div>

Traceback

File c:\users\xinxi\appdata\local\programs\python\python37\lib\site-packages\otree\chat.py, line 53, in chat_template_tag+
File c:\users\xinxi\appdata\local\programs\python\python37\lib\site-packages\otree\templating\nodes.py, line 817, in wrender+
File c:\users\xinxi\appdata\local\programs\python\python37\lib\site-packages\otree\templating\nodes.py, line 189, in render

It is unclear to me why the code is no longer working. I would appreciate any suggestions. 

Thanks,
Xinxin

#2 by Xinxin

Ok. I think I figured it out. It is because in the function vars_for_template(), I returned a string variable named "participant", but participant is used in the chat_template_tag.

Write a reply

Set forum username