I am trying to follow a post over creating and running a Rasa bot
Steps already did:
- I could get all working folders
- Got the basic data files
- Trained Nlu and Core
- launched action server and command line
- So here the expectation is User enters Input like 'Hi or hello' and then bot responds and continues the chat
Actual results: Seeing below error.
make cmdline
python -m rasa_core.run -d models/current/dialogue -u models/current/nlu --endpoints endpoints.yml
C:\Python3.6\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
2019-05-14 17:06:45 INFO root - Rasa process starting
2019-05-14 17:06:49 INFO rasa_nlu.components - Added 'nlp_spacy' to component cache. Key 'nlp_spacy-en'.
2019-05-14 17:07:18.101829: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-05-14 17:07:19 INFO root - Rasa Core server is up and running on http://localhost:5005
Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input -> hey
127.0.0.1 - - [2019-05-14 17:08:23] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 190 0.254340
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python3.6\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Python3.6\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\Python3.6\lib\site-packages\rasa_core\channels\console.py", line 114, in record_messages
for response in bot_responses:
File "C:\Python3.6\lib\site-packages\rasa_core\channels\console.py", line 71, in send_message_receive_stream
with requests.post(url, json=payload, stream=True) as r:
AttributeError: __enter__
On preliminary search over forums, seems it is a Python code issue, as I understand it try to get bot responses using 'WITH' keyword ?
Any pointers on how can I get it sorted please ?
Thanks in advance,
Venky
Related
I have a docker compose running where a django backend, opensearch & opensearch dashboard are running. I have connected the backend to talk to opensearch and I'm able to query it successfully. I'm trying to create indexes using this command inside the docker container.
./manage.py opensearch --rebuild
Reference: https://django-opensearch-dsl.readthedocs.io/en/latest/getting_started/#create-and-populate-opensearchs-indices
I get the following error when I run the above command
root#ed186e462ca3:/app# ./manage.py opensearch --rebuild
/usr/local/lib/python3.6/site-packages/OpenSSL/crypto.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography import utils, x509
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 224, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 37, in load_command_class
return module.Command()
File "/usr/local/lib/python3.6/site-packages/django_opensearch_dsl/management/commands/opensearch.py", line 32, in __init__
if settings.TESTING: # pragma: no cover
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 80, in __getattr__
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'TESTING'
Sentry is attempting to send 1 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
I'm not sure where I'm going wrong. Any help would be greatful.
TIA
For future reference, this was indeed a bug in django-opensearch-dsl which was fix in the 0.3.0 release.
I have a problem during the execution of my python script from crontab, which consists of an insert operation in the firestore database.
db.collection(u'ab').document(str(row["Name"])).collection(str(row["id"])).document(str(row2["id"])).set(self.packStructure(row2))
When I execute normally with python3 script.py command it works, but when I execute it from crontab it return the following error:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/axatel/angel_bridge/esportazione_firebase/main.py", line 23, in <module>
dato.getDati(dato, db, cursor, cursor2, fdb, select, anagrafica)
File "/home/axatel/angel_bridge/esportazione_firebase/dati.py", line 19, in getDati
db.collection(u'ab').document(str(row["Name"])).collection(str(row["id"])).document(str(row2["id"])).set(self.packStructure(row2))
File "/home/axatel/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/document.py", line 234, in set
write_results = batch.commit()
File "/home/axatel/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/batch.py", line 147, in commit
metadata=self._client._rpc_metadata,
File "/home/axatel/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/gapic/firestore_client.py", line 1121, in commit
request, retry=retry, timeout=timeout, metadata=metadata
File "/home/axatel/.local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/home/axatel/.local/lib/python3.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
on_error=on_error,
File "/home/axatel/.local/lib/python3.7/site-packages/google/api_core/retry.py", line 184, in retry_target
return target()
File "/home/axatel/.local/lib/python3.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
return func(*args, **kwargs)
File "/home/axatel/.local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.ServiceUnavailable: 503 DNS resolution failed for service: firestore.googleapis.com:443
I really don't understand what's the problem, because the connection at the database works every time the script is started in both ways.
Is there a fix for this kind of issue?
I found something that might be helpful. There is nice troubleshooting guide and there is a part there, which seems to be related:
If your command works by invoking a runtime like python some-command.py perform a few checks to determine that the runtime
version and environment is correct. Each language runtime has quirks
that can cause unexpected behavior under crontab.
For python you might find that your web app is using a virtual
environment you need to invoke in your crontab.
I haven't seen such error running Firestore API, but this seems to match to your issue.
I found the solution.
The problem occured because the timeout sleep() value was lower than expected, so the database connection function starts too early during boot phase of machine. Increasing this value to 45 or 60 seconds fixed the problem.
#time.sleep(10) # old version
time.sleep(60) # working version
fdb = firebaseConnection()
def firebaseConnection():
# firebase connection
cred = credentials.Certificate('/database/axatel.json')
firebase_admin.initialize_app(cred)
fdb = firestore.client()
if fdb:
return fdb
else:
print("Error")
sys.exit()
I have created a server using Flask for a demonstration of my ML model. I was running it on Google Colab and using flask-ngrok for tunneling. It was working properly, but suddenly it stopped working today and is showing this error:
=> loading checkpoint './semi_supervised_model_3/ckpt_epoch_10.00.pth'
=> loaded checkpoint './semi_supervised_model_3/ckpt_epoch_10.00.pth' (epoch 10.0)
* Serving Flask app "demo_Server" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 1182, in run
self.function(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/dist-packages/flask_ngrok.py", line 70, in start_ngrok
ngrok_address = _run_ngrok()
File "/usr/local/lib/python3.6/dist-packages/flask_ngrok.py", line 38, in _run_ngrok
tunnel_url = j['tunnels'][0]['public_url'] # Do the parsing of the get
IndexError: list index out of range
What is the meaning of this error? Why is it coming even when I didn't change anything?
My problem got solved when I terminated the current session. In the new session, I reinstalled flask-ngrok and it worked fine.
The docs for the %run magic -e option state:
ignore sys.exit() calls or SystemExit exceptions in the script being
run. This is particularly useful if IPython is being used to run
unittests, which always exit with a sys.exit() call. In such cases you
are interested in the output of the test results, not in seeing a
traceback of the unittest module.
This works when running scripts but doesn't seem to work when running modules.
So when I type %run -e -m pytest I still get a traceback when a test fails due the SystemExit thrown by pytest which is case mentioned in the docs above that -e is meant to address. I know I can type !pytest but I don't want to wait until pytest completed before I start to see results, and I also want to add the current directory to to module search path.
I am running IPython within Spyder but the behaviour is the same if I run IPython from the Windows command prompt. I there any way of doing what I want and avoiding the distracting traceback?
I ran the following test with %run -m pytest from the spyder ipython console
import pytest
def test_fail():
assert 0
The output was:
============================= test session starts =============================
platform win32 -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: D:\home\shane\temp\pytest
collected 1 item
test_dummy.py F [100%]
================================== FAILURES ===================================
__________________________________ test_fail __________________________________
def test_fail():
> assert 0
E AssertionError
test_dummy.py:21: AssertionError
=========================== short test summary info ===========================
FAILED test_dummy.py::test_fail - AssertionError
============================== 1 failed in 0.03s ==============================
Traceback (most recent call last):
File "c:\opt\python37\lib\runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "c:\opt\python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "c:\opt\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\opt\python37\lib\site-packages\pytest\__main__.py", line 7, in <module>
raise SystemExit(pytest.main())
SystemExit: ExitCode.TESTS_FAILED
I was just learning 'TensorFlow Mechanics 101'. Error occurred when I run fully_connected_feed.py for trainning the MNIST data:
Step 1800: loss = 0.30 (0.002 sec)
Step 1900: loss = 0.44 (0.003 sec)
Training Data Eval:
Num examples: 55000 Num correct: 49180 Precision # 1: 0.8942
Validation Data Eval:
Num examples: 5000 Num correct: 4509 Precision # 1: 0.9018
Test Data Eval:
Num examples: 10000 Num correct: 9023 Precision # 1: 0.9023
An exception has occurred, use %tb to see the full traceback.
SystemExit
D:\software\anaconda\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py:2870:
UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
After I typed '%tb', it shows:
%tb
Traceback (most recent call last):
File "<ipython-input-1-984b11309266>", line 1, in <module>
runfile('D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py', wdir='D:/wangjc/pythonTest/TensorFlow')
File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 707, in runfile
execfile(filename, namespace)
File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py", line 277, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "D:\software\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
SystemExit
I have found a question like me, but actually it is not the same problem as me. This error message shows different from me:
TypeError: run() got an unexpected keyword argument 'argv'
Also, I installed TensorFlow 1.1.0 by'pip install'.
And, I tried to use several kinds of 'fully_connected_feed.py' code in different TensorFlow version, but other err ( if using lower version ) or the same err occurs.
Some people says the 'SystemExit' error occurs because there is a CMD thread problem. But I don't know whether it is the root and where it is.
Please help me to solve this problem. Thanks!
My ide environment is:
windows 10
Anaconda Python 3.5
TensorFlow 1.1.0
TensorFlow was installed by this code:
(tensorflow) wangjc#wangjc-Inspiron-3668:~$ pip install --ignore-installed --upgrade https://xxxxxxxx.whl
The version shows below:
import tensorflow as tf
tf.VERSION
Out[4]: '1.1.0'
From your traceback:
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
the call to main is wrapped inside a _sys.exit() call that kills the quits the program once it has finished. The message you get comes from running the file inside an iPython iteractive shell. sys.exit() raises a SystemExit exception that normally is used to quit python. iPython's shell, however, captures that exception and shows it to you with a warning. This, however, does not affect your program. Just ignore the message or remove the _sys.exit() wrapping the call to main() in your script.