Search code examples
python-2.7python-docx

Python: package docx can't open a docx


I want to use python to open a word. I use win32com and it works. I find a package named docx and I really think it is very useful. But when I used it to open a wordfile, it raised valueError.

valueError: file '1.doc' is not a Word file, content type is 'applicationnd.openxmlformats-officedocument.themeManager+xml'


Solution

  • Similar problem discussed here: can't open a .docx file #229
    It looks like that it doesn't work with old doc files.
    Try converting the doc file to docx - as lieuzhenghong did in the link - see if that solves the error