oTree Forum >

AttributeError: module 'constants' has no attribute 'endowment'

#1 by papayapap

Hi all, I am completely new to Otree. To start off, I am trying to follow the video series from https://www.accountingexperiments.com/post/otree-tutorial-2021/

In the second video, we program a trust game. I followed all the steps exactly as he did (and imported "import constants as Constants") until minute 27 when he starts the browser in the cmd with "otree devserver". When I do this, I get the error message "AttributeError: module 'constants' has no attribute 'endowment'".

The error comes from the lines 30-38 where the group-level information is defined.

class Group(BaseGroup):
    sent_amount = models.CurrencyField(
        label="How much do you want to send to participant B?",
    sent_back_amount = models.CurrencyField(
        label="How much do you want to send back?"
Which is strange because endowment should not be part of the Constants module but what we defined earlier in the class C(BaseConstants). 

Does somebody have an idea what might be going? Thank you very much and sorry if it is too specific..

#2 by Victor

I should probably answer this one since I made that video. I believe it should be C.endowment 

This changed a while back and I may have confused it in the video.

Does that work?

#3 by papayapap

Thank you, Victor, for your help and for the amazing video series! Indeed, using C. this solved this error. I have a new one directly but will try myself first ;-)

Write a reply

Set forum username