3
하려고은 jnius와 아견 - 응용 프로그램을 실행하려고하지만 모든 것이 잘 작동 (JDK, 파이썬 2.7 & 파이썬 3.6 자바 1.8은 맥 OS 시에라() tika.detect의 출력은 괜찮 문제가있어) parseToString
명령까지. 그것은 당신이이 명령을 실행하는 경우 보여주는 팝업이 나타납니다 (너무 자바 프로그램으로 테스트하고 그것은 작동합니다). 하지만 jnius로 실행하면 작업이 중단되고 출력이없고 오류도 발생하지 않습니다.JNIUS & 티카 - 오류 parseToString
import os
os.environ['CLASSPATH'] = "tika-app-1.14.jar"
from jnius import autoclass
from jnius import JavaException
# Import the Java classes
Tika = autoclass('org.apache.tika.Tika')
Metadata = autoclass('org.apache.tika.metadata.Metadata')
File = autoclass('java.io.File')
# Raise an exception and continue if parsing fails
try:
file = File('./source/test.doc')
tika = Tika()
meta = Metadata()
detectText = tika.detect(file)
print(detectText) # Working the output is: application/msword
contentText = tika.parseToString(file) #here it stops no further steps are executed
print(contentText)
except (JavaException,UnicodeDecodeError) as e:
print("ERROR: %s" % (e))