2017-07-05 38 views
1

我正在嘗試使用textract將我的.doc文件轉換爲純文本。使用Python將.doc轉換爲純文本

import textract 
text = textract.process('path/to/file.extension') 

但我收到此錯誤

AttributeError: 'module' object has no attribute 'process' 
+1

您正在使用的textract的版本? – Tanu

+0

@Tanu我正在使用1.6.1 –

+0

您是否成功安裝了所有其他依賴項? - 'apt-get install python-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils pstotext tesseract-ocr flac ffmpeg lame libmad0 libsox -fmt-mp3 sox libjpeg-dev swig libpulse-dev(用於Ubuntu)。在我的系統上正常工作。 – Tanu

回答

1

確保您正在嘗試運行Python的文件的名稱不是textract.py

如果是這樣的名字,你會得到錯誤:

AttributeError: 'module' object has no attribute 'process'