Live method testing with bots

135 views
Skip to first unread message

Alice CHING

unread,
Nov 28, 2021, 10:48:48 PM11/28/21
to oTree help & discussion
Hi All,

I'm writing command line bot to test my live method using function "call_live_method". I encountered the following error yet in my function call, I didn't specify the argument "case".

TypeError: call_live_method() got an unexpected keyword argument 'case'

My code:

call_live_method code.png

The full traceback is as follows:

call_live_method().png

I was wondering if anyone has experience using call_live_method and could give me some insights about how to debug :)

Best regards,
Ningning

Chris @ oTree

unread,
Nov 28, 2021, 10:52:58 PM11/28/21
to oTree help & discussion
You should define the function like this:

def call_live_method(method, **kwargs):

The **kwargs is kind of an "et cetera" meaning that any unspecified arguments will be bundled in there. You can read about it online. And you only need to check page_class if you have multiple pages with live methods.

Alice CHING

unread,
Nov 28, 2021, 11:01:41 PM11/28/21
to oTree help & discussion
Hi Chris,

Thanks for the prompt reply!

I read about call_live_method in the documentation and thought we should replace "**kwargs" with arguments like "page_class=pages.MyPage". 

Thanks for the timely guidance :)

Cheers,
Ningning
Reply all
Reply to author
Forward
0 new messages