How to fix error

Hi, I have installed rasa_core, then i did pip install rasa x. I have the latest versions of both rasa core and rasa x. I have connected my bot to the database and I am fetching the data from there.Here is the code. I do rasa run actions and then rasa shell

class ActionHelloWorld(Action):

def name(self) -> Text:
    return "action_hello_world"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    # Getting slot values
  user = "postgres"
  password = "postgres"
  host = "localhost"
  port = 5432
  database = "mydatabase"

  db_conn = psycopg2.connect(host=host, user=user, password=password, database=database)
  db_cursor = db_conn.cursor()
  sql_query = "SELECT * FROM operational_metadata WHERE entity_name = %s and insert_date = %s ;"
  print("i am good")
  result = db_cursor.execute(sql_query,(entity_name,insert_date,))
  results1 = db_cursor.fetchall()
  for r in results1:
      response={"entity_name :{r[0]}  insert date :{r[1]}   label :{r[2]}"}

  return [SlotSet('email', receiver_email), SlotSet('entity_name', entity_name), SlotSet('insert_date', insert_date)]

I got this in the terminal running rasa shell:

uture: <Task finished coro=<configure_app..run_cmdline_io() done, defined at /Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/> exception=TimeoutError()> Traceback (most recent call last): File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 134, in run_cmdline_io sender_id=conversation_id, File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 151, in record_messages async for response in bot_responses: File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 107, in send_message_receive_stream async for line in resp.content: File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/”, line 39, in anext rv = await self.read_func() File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/”, line 328, in readline await self._wait(‘readline’) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/”, line 296, in _wait await waiter File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/aiohttp/”, line 596, in exit raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError Transport closed @ (‘’, 52636) and exception experienced during error handling 2020-05-23 00:02:37 ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<RestInput.on_message_wrapper() done, defined at /Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/> exception=AttributeError("‘list’ object has no attribute ‘strip’",)> Traceback (most recent call last): File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 407, in on_message_wrapper await on_new_message(message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 83, in handler await app.agent.handle_message(*args, **kwargs) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 486, in handle_message return await processor.handle_message(message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 108, in handle_message await self._predict_and_execute_next_action(message.output_channel, tracker) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 552, in _predict_and_execute_next_action action, tracker, output_channel, self.nlg, policy, confidence File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 665, in _run_action await self._send_bot_messages(events, tracker, output_channel) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/”, line 594, in _send_bot_messages await output_channel.send_response(tracker.sender_id, e.message()) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 186, in send_response await self.send_text_message(recipient_id, message.pop(“text”), **message) File “/Users/gandharv/.pyenv/versions/3.6.8/lib/python3.6/site-packages/rasa/core/channels/”, line 327, in send_text_message for message_part in text.strip().split("\n\n"): AttributeError: ‘list’ object has no attribute ‘strip’

I get no error in the terminal that runs rasa run actions

Hi @gandharv30!

I think the error is because the response is not a string.

Python lists cannot be divided into separate lists based on characters that appear in the values of a list. This is unlike strings which values can be separated into a list. The AttributeError is an exception thrown when an object does not have the attribute you tried to access. The ‘list’ object has no attribute ‘split’ and you’re trying to call python split function on the whole list of lines, and you can’t split a list of strings, only a string. So, you need to split each line, not the whole thing.

To solve the above problem, you need to iterate over the strings in the list to get individual strings; then, you can call the split() function.