Python-grammar_check / URLIb会话超时错误

时间:2018-10-12 11:00:01

标签: python session-state context-free-grammar

在使用python grammar_check进行单词文档的语法检查时,它可以正常工作,但是当我运行一组单词文档时,出现以下错误。如何解决呢?

这是错误消息:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/grammar_check-1.3.1- 
py3.5.egg/grammar_check/__init__.py", line 302, in _get_root
with urlopen(url, data, cls._TIMEOUT) as f:
File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib/python3.5/urllib/request.py", line 444, in 
_call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 1282, in 
http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.5/urllib/request.py", line 1257, in 
do_open
r = h.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in 
getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 258, in 
_read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/grammar_check- 
1.3.1-py3.5.egg/grammar_check/__init__.py", line 370, in 
_start_server
    with urlopen(cls._url, data, cls._TIMEOUT) as f:
  File "/usr/lib/python3.5/urllib/request.py", line 163, in 
 urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 466, in open
    response = self._open(req, data)
  File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
    '_open', req)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in 
  _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 1282, in 
  http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.5/urllib/request.py", line 1257, in 
  do_open
    r = h.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1197, in 
  getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in 
  _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):
  File "/home/spi/PycharmProjects/test/CE_level.py", line 62, in 
 <module>
    matches = lang_tool.check(sent)
  File "/usr/local/lib/python3.5/dist-packages/grammar_check- 
 1.3.1-py3.5.egg/grammar_check/__init__.py", line 243, in check
    root = self._get_root(self._url, self._encode(text, srctext))
  File "/usr/local/lib/python3.5/dist-packages/grammar_check- 
  1.3.1-py3.5.egg/grammar_check/__init__.py", line 306, in 
 _get_root
     cls._start_server()
  File "/usr/local/lib/python3.5/dist-packages/grammar_check- 
  1.3.1-py3.5.egg/grammar_check/__init__.py", line 375, in 
  _start_server
    raise ServerError('{}: {}'.format(cls._url, e))
  grammar_check.ServerError: http://127.0.0.1:8081: [Errno 104] 
 Connection reset by peer

以退出代码1完成的过程

0 个答案:

没有答案