chrismattmann / tika-python

Tika-Python is a Python binding to the Apache Tika™ REST services allowing Tika to be called natively in the Python community.
Apache License 2.0
1.51k stars 234 forks source link

No such file or directory: '/tmp/tika-server.jar' #352

Closed ghost closed 1 year ago

ghost commented 3 years ago

Why I'm getting this message when I try to use tika?

Traceback (most recent call last):
  File "/usr/share/pyshared/test.py", line 124, in <module>
    raw = parser.from_file(str(path))
  File "/home/fred/.local/lib/python3.8/site-packages/tika/parser.py", line 40, in from_file
    output = parse1(service, filename, serverEndpoint, headers=headers, config_path=config_path, requestOptions=requestOptions)
  File "/home/fred/.local/lib/python3.8/site-packages/tika/tika.py", line 337, in parse1
    status, response = callServer('put', serverEndpoint, service, f,
  File "/home/fred/.local/lib/python3.8/site-packages/tika/tika.py", line 532, in callServer
    serverEndpoint = checkTikaServer(scheme, serverHost, port, tikaServerJar, classpath, config_path)
  File "/home/fred/.local/lib/python3.8/site-packages/tika/tika.py", line 595, in checkTikaServer
    if not checkJarSig(tikaServerJar, jarPath):
  File "/home/fred/.local/lib/python3.8/site-packages/tika/tika.py", line 615, in checkJarSig
    with open(jarPath, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tika-server.jar'
leonlee723 commented 3 years ago

me too. Does anyone keep maintaining this project?

ujjawalcse commented 2 years ago

Hey @ragehead , Just download the jar file from https://repo1.maven.org/maven2/org/apache/tika/tika-server/

Suppose you downloaded tika-server-1.24.jar and tika-server-1.24.jar.md5 in a folder tika-server. Then just copy those two files to /tmp/ like sudo cp tika-server/tika-server-1.24.jar /tmp/tika-server.jarand sudo cp tika-server/tika-server-1.24.jar.md5 /tmp/tika-server.jar.md5

Thanks

chrismattmann commented 1 year ago

So some systems won't let you write to /tmp and as such it won't create the log files that tika-python needs to read for the background tika server. Recommend you make sure your system permissions allow writing to /tmp. Thanks.