Apache tika:socket.gaierror:[Errno 8]提供nodename或servname,或者不知道

时间:2018-03-02 06:52:14

标签: python macos localhost apache-tika

我正在运行以下代码

import tika
from tika import parser
parsed = parser.from_file('Lubdhak_Resume_v6.pdf')
print(parsed["metadata"])
print(parsed["content"])

我不断收到此错误

/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/bin/python3.6 "/Users/lubi/Default Folder/WorkSpaces/PycharmProjects/Headway.ai/tika_check.py"
Traceback (most recent call last):
  File "/Users/lubi/Default Folder/WorkSpaces/PycharmProjects/Headway.ai/tika_check.py", line 3, in <module>
    parsed = parser.from_file('Lubdhak_Resume_v6.pdf')
  File "/usr/local/lib/python3.6/site-packages/tika/parser.py", line 36, in from_file
    jsonOutput = parse1('all', filename, serverEndpoint, headers=headers)
  File "/usr/local/lib/python3.6/site-packages/tika/tika.py", line 316, in parse1
    headers, verbose, tikaServerJar, rawResponse=rawResponse)
  File "/usr/local/lib/python3.6/site-packages/tika/tika.py", line 510, in callServer
    serverEndpoint = checkTikaServer(scheme, serverHost, port, tikaServerJar, classpath)
  File "/usr/local/lib/python3.6/site-packages/tika/tika.py", line 555, in checkTikaServer
    alreadyRunning = checkPortIsOpen(serverHost, port)
  File "/usr/local/lib/python3.6/site-packages/tika/tika.py", line 681, in checkPortIsOpen
    remoteServerIP  = socket.gethostbyname(remoteServerHost)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Process finished with exit code 1

尝试在Mac OSx 10.12.6(Sierra)上编辑etc / hosts,默认为:

127.0.0.1        localhost
255.255.255.255 broadcasthost
::1         localhost
fe80::1%lo0  localhost

错误在哪里?

0 个答案:

没有答案