Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

执行法务咨询自动问答时报错 #3

Open
systemime opened this issue Feb 14, 2019 · 5 comments
Open

执行法务咨询自动问答时报错 #3

systemime opened this issue Feb 14, 2019 · 5 comments

Comments

@systemime
Copy link

执行法务咨询自动问答脚本,运行 python crime_qa.py后,正常输入问题程序崩溃出错,出错完整内容如下```
loaded 300785 word embedding, finished
question:我要离婚
GET http://127.0.0.1:9200/crime_data/crime/_search?size=20 [status:N/A request:0.000s]
Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f967b5e55c0>: Failed to establish a new connection: [Errno 111] Connection refused
GET http://127.0.0.1:9200/crime_data/crime/_search?size=20 [status:N/A request:0.000s]
Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f967b5e55f8>: Failed to establish a new connection: [Errno 111] Connection refused
GET http://127.0.0.1:9200/crime_data/crime/_search?size=20 [status:N/A request:0.000s]
Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f967b5e5780>: Failed to establish a new connection: [Errno 111] Connection refused
GET http://127.0.0.1:9200/crime_data/crime/_search?size=20 [status:N/A request:0.000s]
Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f967b5ad400>: Failed to establish a new connection: [Errno 111] Connection refused
Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 172, in perform_request
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/cc/anaconda3/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
conn = self._new_conn()
File "/home/cc/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f967b5ad400>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "crime_qa.py", line 137, in
final_answer = handler.search_main(question)
File "crime_qa.py", line 105, in search_main
candi_answers = self.search_es(question)
File "crime_qa.py", line 42, in search_es
res = self.search_specific(question)
File "crime_qa.py", line 35, in search_specific
searched = self.es.search(index=self._index, doc_type=self.doc_type, body=query_body, size=20)
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/client/init.py", line 660, in search
doc_type, '_search'), params=params, body=body)
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "/home/cc/anaconda3/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 181, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f967b5ad400>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f967b5ad400>: Failed to establish a new connection: [Errno 111] Connection refused)

@QY-AI
Copy link

QY-AI commented Apr 13, 2019

本地elasticsearch服务有没有启动,windows下我用的6.7没问题

@badbabys
Copy link

loaded 300785 word embedding, finished
question:我要离婚
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "D:\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
raise err
File "D:\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 220, in perform_request
method, url, body, retries=Retry(False), headers=request_headers, **kw
File "D:\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 333, in increment
raise six.reraise(type(error), error, _stacktrace)
File "D:\Anaconda3\lib\site-packages\urllib3\packages\six.py", line 686, in reraise
raise value
File "D:\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "D:\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "D:\Anaconda3\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "D:\Anaconda3\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "D:\Anaconda3\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "D:\Anaconda3\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "D:\Anaconda3\lib\http\client.py", line 964, in send
self.connect()
File "D:\Anaconda3\lib\site-packages\urllib3\connection.py", line 166, in connect
conn = self._new_conn()
File "D:\Anaconda3\lib\site-packages\urllib3\connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001ADE9A11780>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/pycharm/CrimeKgAssitant-master/crime_qa.py", line 137, in
final_answer = handler.search_main(question)
File "D:/pycharm/CrimeKgAssitant-master/crime_qa.py", line 105, in search_main
candi_answers = self.search_es(question)
File "D:/pycharm/CrimeKgAssitant-master/crime_qa.py", line 42, in search_es
res = self.search_specific(question)
File "D:/pycharm/CrimeKgAssitant-master/crime_qa.py", line 35, in search_specific
searched = self.es.search(index=self._index,body=query_body, size=20)
File "D:\Anaconda3\lib\site-packages\elasticsearch\client\utils.py", line 84, in wrapped
return func(*args, params=params, **kwargs)
File "D:\Anaconda3\lib\site-packages\elasticsearch\client_init
.py", line 811, in search
"GET", _make_path(index, "_search"), params=params, body=body
File "D:\Anaconda3\lib\site-packages\elasticsearch\transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "D:\Anaconda3\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 232, in perform_request
raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x000001ADE9A11780>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x000001ADE9A11780>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。)

同样是报错

@ychqq13
Copy link

ychqq13 commented Aug 3, 2019

求问 该怎么启动elasticsearch服务

@Traceve
Copy link

Traceve commented Nov 18, 2019

把端口号加上引号

@lris617
Copy link

lris617 commented Mar 4, 2023

请问,问题解决了吗,我也是这样报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants