Thanks for the response @MuraliChandran14
. I figured out the previous problem. I was mistakenly using the test database (silly of me, I know
) in which there was no record for the query. I fixed that but now I got an error saying:
2020-06-08 12:31:02 ERROR asyncio - Task exception was never retrieved
future: <Task finished coro=<configure_app..run_cmdline_io() done, defined at c:\users\praneeth\appdata\local\programs\python\python36\lib\site-packages\rasa\core\run.py:128> exception=TypeError(‘must be str, not list’,)>
Traceback (most recent call last):
File “c:\users\praneeth\appdata\local\programs\python\python36\lib\site-packages\rasa\core\run.py”, line 134, in run_cmdline_io
sender_id=conversation_id,
File “c:\users\praneeth\appdata\local\programs\python\python36\lib\site-packages\rasa\core\channels\console.py”, line 152, in record_messages
button_question = print_bot_output(response)
File “c:\users\praneeth\appdata\local\programs\python\python36\lib\site-packages\rasa\core\channels\console.py”, line 34, in print_bot_output
cli_utils.print_color("Image: " + message.get(“image”), color=color)
TypeError: must be str, not list
This is my code in actions.py
import mysql.connector as sql
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
database = sql.connect(
host = hostname,
user = username,
passwd = password,
database = database
)
mycursor = database.cursor()
query = <MySQL query>
mycursor.execute(query)
result = mycursor.fetchall()
"""
Some code here to create the buttons dictionary from fetched result as "mybuttons"
the structure of mybuutons at the end of code is:
[{'title': title_name, 'payload': '/inform{slotname: slotvalue}'}, {'title2': title_name2, 'payload': '/inform{slotname2: slotvalue2}'}, {'title3': title_name3, 'payload': '/inform{slotname3: slotvalue3}'}, {'title4': title_name4, 'payload': '/inform{slotname4: slotvalue4}'}]
I tried printing this "mybuttons" variable and it runs as expected.
the next piece of code is as below
"""
dispatcher.utter_message("These are the eligible orders for return: ",mybuttons)
return []
Where am I doing this wrong? The buttons argument in utter_message should be a list but the error says must be a str not a list.
Can you please help me with a solution or at least point me to the right direction?
Thanks @MuraliChandran14