Weatherbot Tutorial

Hey,

I’ve run the weaterbot example (latest version) of Justina last week. I tried to replicate it this week, but I see an error which I do not understand.

(I train and load the bot using dialogue_management_model.py. Then I type “Hello” and get an Attribute Error saying __enter__

Bot loaded. Type a message and press enter (use '/stop' to exit):
Hello
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 936, in handle_one_response
    self.run_application()
Exception in thread Thread-7:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\rasa_core\channels\console.py", line 110, in record_messages
    for response in bot_responses:
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\rasa_core\channels\console.py", line 67, in send_message_receive_stream
    stream=True) as r:
AttributeError: __enter__
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 910, in run_application
    self.process_result()

  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 896, in process_result
    self.write(data)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 742, in write
    self._write_with_headers(data)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 764, in _write_with_headers
    self._write(data)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 724, in _write
    self._sendall(data)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\pywsgi.py", line 702, in _sendall
    self.socket.sendall(data)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\_socket3.py", line 418, in sendall
    data_sent += self.send(data_memory[data_sent:], flags)
  File "C:\ProgramData\Anaconda3\envs\weatherbot\lib\site-packages\gevent\_socket3.py", line 391, in send
    return _socket.socket.send(self._sock, data, flags)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Mon Sep 24 10:01:33 2018 {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '54962', 'HTTP_HOST': 'localhost:5005', (hidden keys: 23)} failed with ConnectionAbortedError

127.0.0.1 - - [2018-09-24 10:01:33] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 153 0.170541

Could anyone indicate to me what I might have changed in my system settings that causes the key-error?

I am on Windows 10.

I still do not know what was wrong. I have installed all packages consecutively. The requirments.txt of the repository did not specify all version numbers, maybe causing clashes. An updated version is:

rasa_core==0.11.3
rasa_nlu==0.13.2
spacy==1.8.2
scikit-learn==0.19.1
sklearn-crfsuite==0.3.5
pypandoc==1.4
slackclient==1.3.0
numpy<=1.14.5
setuptools<=39.1.0
rasa_core==0.11.3
git+https://github.com/apixu/apixu-python.git

Cheers, Henry

can share to command you have used ?

Try this command, It might help.

Train-core:

python -m rasa_core.train -s data/stories.md -d domain.yml -o models/dialogue --history 10 --nlu_threshold 0.1 --core_threshold 0.1 --fallback_action utter_default --epochs 300

online training :

python -m rasa_core.train --online -o models/dialogue -d domain.yml -s data/stories.md --endpoints endpoints.yml --history 10 --nlu_threshold 0.1 --core_threshold 0.1 --fallback_action utter_default

Run-core : python -m rasa_core.run -d models/dialogue -u models/nlu/Auto/model_20180917-120247 --endpoints endpoints.yml

I think it due to fallback. it is not trained on hello due to which it want to fallback, but it could not

1 Like

Hey Henry,

Even I am facing the similar error, have you found a solution for it?

Try to install the requirements in an isolated environment as I specified them. I do not recall in detail what went wrong, but make sure that the action server is running before you execute the dialogue_management_model.py.

mkvirtualenv weatherbot
pip install -r requirements.txt  
python -m rasa_core_sdk.endpoint --actions actions
python dialogue_management_model.py

with requirements.txt containing

rasa_core==0.11.3
rasa_nlu==0.13.2
spacy==1.8.2
scikit-learn==0.19.1
sklearn-crfsuite==0.3.5
pypandoc==1.4
slackclient==1.3.0
numpy<=1.14.5
setuptools<=39.1.0
rasa_core==0.11.3
git+https://github.com/apixu/apixu-python.git

“Even I am facing the error” does imply that your are super good at something;)

Thanks Henry, Will execute this way and see if it gets resolved!

1 Like

Additionally please see azizullahs comment. I basically said to add a utter_default action, like

utter_default
 - 'sorry, i did not undersand, could you rephrase'

to the domain.yml.

Hello everyone, I am sorry if it is not appropriate to launch again this conversation but I am new in forum talking.

I am trying to make a chatbot , so first I watched to tutorial from Justina Petraitytė and I tried to make the same weatherbot but I have some troubles to integrate it to slack.

From my slack API I have the error: “Your URL didn’t respond with the value of the challenge parameter” and from ngrok launched I have: “error 502 Bad gateaway”.

Could someone help me please?

Hi, I do not want to use Slack client. Instead would like to connect via some webchat client. What api endpoints are exposed. How can I test it first via postman before connecting some client app to the server?