尝试在python中使用tika解析某些文本时出现504错误

时间:2019-05-25 19:02:50

标签: python tika-server

几周前,我在Windows 10中运行了tika-python,没有任何问题。今天,我不得不重新创建我的virtualenv并将tika升级到1.19版,但是当我尝试照常使用它时,出现了502和504错误一直。

我尝试在ubuntu18.04和以前的tika版本中使用它,并且没有任何更改。

有人可以帮忙吗? (我不是英语为母语的人,如果我的英语不太好,抱歉。)

parsed_data = parser.from_buffer(buffer)

2019-05-25 20:40:42,446 [MainThread  ] [INFO ]  Retrieving http://search.maven.org/remotecontent?filepath=org/apache/tika/tika-server/1.15/tika-server-1.15.jar.md5 to /tmp/tika-server.jar.md5.
Traceback (most recent call last):
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/tika.py", line 651, in getRemoteJar
        urlretrieve(urlOrPath, destPath)
    File "/usr/lib/python3.7/urllib/request.py", line 247, in urlretrieve
        with contextlib.closing(urlopen(url, data)) as fp:
    File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
    File "/usr/lib/python3.7/urllib/request.py", line 531, in open
        response = meth(req, response)
    File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
    File "/usr/lib/python3.7/urllib/request.py", line 569, in error
        return self._call_chain(*args)
    File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
        result = func(*args)
    File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 504: Gateway Time-out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/parser.py", line 51, in from_buffer
        {'Accept': 'application/json'}, False)
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/tika.py", line 506, in callServer
    serverEndpoint = checkTikaServer(scheme, serverHost, port, tikaServerJar, classpath)
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/tika.py", line 557, in checkTikaServer
        if not checkJarSig(tikaServerJar, jarPath):
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/tika.py", line 572, in checkJarSig
        getRemoteJar(tikaServerJar + ".md5", jarPath + ".md5")
    File "/home/ohm/Documentos/TFG/venv/lib/python3.7/site-packages/tika/tika.py", line 661, in getRemoteJar
        urlretrieve(urlOrPath, destPath) 
    File "/usr/lib/python3.7/urllib/request.py", line 247, in urlretrieve
        with contextlib.closing(urlopen(url, data)) as fp:
    File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
    File "/usr/lib/python3.7/urllib/request.py", line 531, in open
        response = meth(req, response)
    File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
    File "/usr/lib/python3.7/urllib/request.py", line 569, in error
        return self._call_chain(*args)
    File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
        result = func(*args)
    File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPErr: HTTP Error 502: Bad Gateway

0 个答案:

没有答案