python中的doc_在windows 10上读取python中的.doc文件
this
,但我的問題是使用textract
工作。我正在尋找(a)讓textract在windows 10上工作的方法,或(b)另一種解決方案。
我正在構(gòu)建一個(gè)需要讀取各種類型文件的系統(tǒng)。我已經(jīng)設(shè)置了pdfminer來閱讀.pdfs,并且基于概述的過程
here
我安裝了textract,現(xiàn)在還可以讀取.docx文件。然而,textract依賴antiword來讀取.doc文件,即使按照說明操作,我也無法讓它工作
here
下面是運(yùn)行textract.process('d.doc')時(shí)的錯(cuò)誤(忽略第一個(gè)錯(cuò)誤,文件肯定存在):
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\textract\parsers\utils.py", line 84, in run
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\ProgramData\Anaconda3\lib\site-packages\textract\parsers\__init__.py", line 77, in process
return parser.process(filename, encoding, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\textract\parsers\utils.py", line 46, in process
byte_string = self.extract(filename, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\textract\parsers\doc_parser.py", line 9, in extract
stdout, stderr = self.run(['antiword', filename])
File "C:\ProgramData\Anaconda3\lib\site-packages\textract\parsers\utils.py", line 91, in run
' '.join(args), 127, '', '',
textract.exceptions.ShellError: The command antiword d.doc failed with exit code 127
總結(jié)
以上是生活随笔為你收集整理的python中的doc_在windows 10上读取python中的.doc文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 前端入门教程(七)CSS属性设置
- 下一篇: Android Studio 超级简单的