J'utilise un script python pour convertir un fichier.doc en un fichier. SMS. Mon code est:Comment installer antiword sur Windows et l'utiliser en python
from subprocess import Popen, PIPE
from docx import opendocx, getdocumenttext
#http://stackoverflow.com/questions/5725278/python-help-using-pdfminer-as-a-library
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from cStringIO import StringIO
import os
def document_to_text(filename, file_path):
if filename[-4:] == ".doc":
cmd = ['antiword', file_path]
p = Popen(cmd, stdout=PIPE)
stdout, stderr = p.communicate()
return stdout.decode('ascii', 'ignore')
elif filename[-5:] == ".docx":
document = opendocx(file_path)
paratextlist = getdocumenttext(document)
newparatextlist = []
for paratext in paratextlist:
newparatextlist.append(paratext.encode("utf-8"))
return '\n\n'.join(newparatextlist)
Pour utiliser le script ci-dessus que je dois installer « antiword », mais le problème est que je ne sais pas comment le faire. Voici le lien où télécharger 'antiword': http://www-stud.rbi.informatik.uni-frankfurt.de/~markus/antiword/
Quelqu'un peut-il m'aider?
Si vous lisez la page vous avez accédé à, vous trouverez les instructions d'installation [] (http://www-stud.rbi.informatik.uni-frankfurt.de/~markus/antiword/00README. GAGNER). – Matthias