AttributeError: 'NoneType' object has no attribute 'co_filename'
lidianxiang opened this issue · 3 comments
当我在我的虚拟环境中执行rasa run --enable-api -m models/medical-final-m3/20190728-212653.tar.gz --port 5000 --endpoints config/endpoints.yml --credentials config/credentials.yml -vv
语句时,出现以下错误:
/conversations/<conversation_id>/tracker/events POST append_events
/model/test/intents POST evaluate_intents
/model/test/stories POST evaluate_stories
/conversations/<conversation_id>/execute POST execute_action
/domain GET get_domain
/mysocket.io OPTIONS handle_request
/ GET hello
/model PUT load_model
/model/parse POST parse
/conversations/<conversation_id>/predict POST predict
/conversations/<conversation_id>/tracker/events PUT replace_events
/conversations/<conversation_id>/story GET retrieve_story
/conversations/<conversation_id>/tracker GET retrieve_tracker
/webhooks/socketio GET socketio_webhook.health
/status GET status
/model/predict POST tracker_predict
/model/train POST train
/model DELETE unload_model
/version GET version
2020-09-02 13:49:01 INFO root - Starting Rasa server on http://localhost:5000
2020-09-02 13:49:01 INFO root - Enabling coroutine debugging. Loop id 140579256401944.
2020-09-02 13:49:01 DEBUG rasa.model - Extracted model to '/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3'.
2020-09-02 13:49:14 INFO rasa.nlu.components - Added 'MitieNLP' to component cache. Key 'MitieNLP-/Users/lidianxiang/Desktop/Doctor-Friende-master/chat/data/total_word_feature_extractor_zh.dat'.
2020-09-02 13:49:14 INFO rasa.nlu.tokenizers.jieba_tokenizer - Loading Jieba User Dictionary at /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Departments_dic.txt
Building prefix dict from the default dictionary ...
2020-09-02 13:49:14 DEBUG jieba - Building prefix dict from the default dictionary ...
Loading model from cache /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/jieba.cache
2020-09-02 13:49:14 DEBUG jieba - Loading model from cache /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/jieba.cache
Loading model cost 2.107 seconds.
2020-09-02 13:49:16 DEBUG jieba - Loading model cost 2.107 seconds.
Prefix dict has been built succesfully.
2020-09-02 13:49:16 DEBUG jieba - Prefix dict has been built succesfully.
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/rasa/nlu/tokenizers/jieba_tokenizer.py:57: ResourceWarning: unclosed file <_io.BufferedReader name='/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Departments_dic.txt'>
jieba.load_userdict(jieba_userdict)
2020-09-02 13:49:17 INFO rasa.nlu.tokenizers.jieba_tokenizer - Loading Jieba User Dictionary at /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Symptoms_dic.txt
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/rasa/nlu/tokenizers/jieba_tokenizer.py:57: ResourceWarning: unclosed file <_io.BufferedReader name='/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Symptoms_dic.txt'>
jieba.load_userdict(jieba_userdict)
2020-09-02 13:49:17 INFO rasa.nlu.tokenizers.jieba_tokenizer - Loading Jieba User Dictionary at /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Diseases_dic.txt
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/rasa/nlu/tokenizers/jieba_tokenizer.py:57: ResourceWarning: unclosed file <_io.BufferedReader name='/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Diseases_dic.txt'>
jieba.load_userdict(jieba_userdict)
2020-09-02 13:49:17 INFO rasa.nlu.tokenizers.jieba_tokenizer - Loading Jieba User Dictionary at /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Drugs_dic.txt
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/rasa/nlu/tokenizers/jieba_tokenizer.py:57: ResourceWarning: unclosed file <_io.BufferedReader name='/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Drugs_dic.txt'>
jieba.load_userdict(jieba_userdict)
2020-09-02 13:49:17 INFO rasa.nlu.tokenizers.jieba_tokenizer - Loading Jieba User Dictionary at /var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Foods_dic.txt
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/rasa/nlu/tokenizers/jieba_tokenizer.py:57: ResourceWarning: unclosed file <_io.BufferedReader name='/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmps0bhxen3/nlu/component_1_JiebaTokenizer/Foods_dic.txt'>
jieba.load_userdict(jieba_userdict)
/Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/sklearn/base.py:253: UserWarning: Trying to unpickle estimator SVC from version 0.20.3 when using version 0.20.4. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
2020-09-02 13:49:18 DEBUG rasa.core.tracker_store - Attempting to connect to database via 'mysql+mysqldb://root:***@localhost:3306/rasa'.
2020-09-02 13:49:18 DEBUG rasa.core.tracker_store - Connection to SQL database 'rasa' successful.
2020-09-02 13:49:18 DEBUG rasa.core.tracker_store - Connected to SQLTrackerStore.
2020-09-02 13:49:18 DEBUG rasa.model - Extracted model to '/var/folders/pw/f22wybpj5zd97xm6dpkl7_fh0000gn/T/tmpsx1iohkm'.
2020-09-02 13:49:18 DEBUG pykwalify.compat - Using yaml library: /Users/lidianxiang/Desktop/Doctor-Friende-master/venv/lib/python3.6/site-packages/ruamel/yaml/init.py
2020-09-02 13:49:23 ERROR asyncio - exception in Task.repr
handle: <Handle <TaskStepMethWrapper object at 0x7fdb4907b978> created at /Users/lidianxiang/anaconda3/lib/python3.6/asyncio/tasks.py:519>
task: Exception in repr AttributeError("'NoneType' object has no attribute 'co_filename'",); value type: <class '_asyncio.Task'>
Traceback (most recent call last):
File "uvloop/cbhandles.pyx", line 121, in uvloop.loop.Handle._format_handle
File "/Users/lidianxiang/anaconda3/lib/python3.6/asyncio/base_tasks.py", line 15, in _task_repr_info
coro = coroutines._format_coroutine(task._coro)
File "/Users/lidianxiang/anaconda3/lib/python3.6/asyncio/coroutines.py", line 323, in _format_coroutine
filename = coro_code.co_filename
AttributeError: 'NoneType' object has no attribute 'co_filename'
我的所有库都是使用requirements.txt中的的版本,rasa版本也是1.2.9
这个问题一直存在,但是影响不大,能够正常运行。影响的主要原因是mysql连接问题
进入mysql中,输入
set global wait_timeout=60*60*30;
来更改等待时间。
同时我也将rasa的版本降到了1.2.5, scikit-learn的版本降到了0.20.3。
下面是我的requirement.txt
Package Version
absl-py 0.9.0
aiofiles 0.4.0
aiohttp 3.6.2
alembic 1.0.11
APScheduler 3.6.1
asn1crypto 0.24.0
astor 0.8.0
async-generator 1.10
async-timeout 3.0.1
attrs 19.3.0
Automat 0.7.0
beautifulsoup4 4.9.0
boto3 1.12.46
botocore 1.15.46
cachetools 4.1.0
certifi 2020.4.5.1
cffi 1.12.3
characteristic 14.3.0
chardet 3.0.4
Click 7.0
cloudpickle 1.2.2
colorama 0.4.3
colorclass 2.2.0
coloredlogs 10.0
colorhash 1.0.2
ConfigArgParse 0.14.0
constantly 15.1.0
contextvars 2.4
cryptography 2.7
cycler 0.10.0
decorator 4.4.0
dnspython 1.16.0
docopt 0.6.2
docutils 0.14
fakeredis 1.0.3
fbmessenger 6.0.0
Flask 1.1.1
Flask-Cors 3.0.8
future 0.17.1
gast 0.2.2
gevent 1.4.0
google-auth 1.14.1
google-auth-oauthlib 0.4.1
google-pasta 0.2.0
greenlet 0.4.15
grpcio 1.22.0
h11 0.8.1
h2 3.2.0
h5py 2.9.0
hpack 3.0.0
hstspreload 2020.4.24
httplib2 0.17.3
httptools 0.0.13
httpx 0.9.3
humanfriendly 4.18
hyperframe 5.2.0
hyperlink 19.0.0
idna 2.8
idna-ssl 1.1.0
immutables 0.12
importlib-metadata 1.6.0
incremental 17.5.0
isodate 0.6.0
itsdangerous 1.1.0
jieba 0.39
Jinja2 2.10.1
jmespath 0.9.4
joblib 0.14.1
jsonpickle 1.3
jsonschema 2.6.0
kafka-python 1.4.6
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
klein 19.6.0
Mako 1.0.14
Markdown 3.1.1
markdownify 0.4.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mattermostwrapper 2.2
mitie 0.7.36
mixpanel 4.4.0
mock 3.0.5
multidict 4.7.5
mysqlclient 1.4.6
neobolt 1.7.17
neotime 1.7.4
networkx 2.4
numpy 1.16.4
oauth2client 4.1.3
oauthlib 3.1.0
opt-einsum 3.2.1
packaging 19.0
pika 1.0.1
pip 20.0.2
prompt-toolkit 2.0.9
protobuf 3.9.0
psycopg2-binary 2.8.5
py2neo 4.3.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.19
pydot 1.4.1
Pygments 2.3.1
PyHamcrest 1.9.0
PyJWT 1.7.1
pykwalify 1.7.0
pymongo 3.8.0
pyparsing 2.4.0
pyrsistent 0.16.0
PySocks 1.7.0
python-crfsuite 0.9.6
python-dateutil 2.8.0
python-editor 1.0.4
python-engineio 3.11.2
python-socketio 4.4.0
python-telegram-bot 11.1.0
pytz 2019.1
PyYAML 5.1.1
questionary 1.5.2
rasa 1.2.5
rasa-sdk 1.2.0
redis 3.3.11
requests 2.23.0
requests-oauthlib 1.3.0
requests-toolbelt 0.9.1
rfc3986 1.4.0
rocketchat-API 0.6.34
rsa 4.0
ruamel.yaml 0.15.100
s3transfer 0.3.3
sanic 19.3.1
Sanic-Cors 0.9.9.post4
sanic-jwt 1.3.2
Sanic-Plugins-Framework 0.9.2
scikit-learn 0.20.3
scipy 1.4.1
setuptools 46.1.3
simplejson 3.16.0
six 1.14.0
sklearn-crfsuite 0.3.6
slackclient 1.3.2
sniffio 1.1.0
sortedcontainers 2.1.0
soupsieve 2.0
SQLAlchemy 1.3.16
tabulate 0.8.3
tensorboard 1.13.1
tensorflow 1.13.1
tensorflow-addons 0.9.1
tensorflow-estimator 1.13.0
tensorflow-hub 0.7.0
tensorflow-probability 0.7.0
termcolor 1.1.0
terminaltables 3.1.0
tqdm 4.31.1
Tubes 0.2.0
twilio 6.26.3
Twisted 19.2.1
typeguard 2.7.1
typing 3.7.4
typing-extensions 3.7.4
tzlocal 2.0.0
ujson 1.35
urllib3 1.24.3
uvloop 0.12.2
wcwidth 0.1.7
webexteamssdk 1.1.1
websocket-client 0.54.0
websockets 6.0
Werkzeug 0.15.5
wheel 0.34.2
wrapt 1.12.1
yarl 1.3.0
zipp 3.1.0
zope.interface 4.6.0
现在代码也成功运行了,感谢大佬的代码分享~
刚看到这个issue,感谢你的分享~!^_^