I want to open a .docx file with function Document()
. But it always returns:
docx.opc.exceptions.PackageNotFoundError: Package not found at '/home/chaomaer/PycharmProjects/demo/lab1/book1.docx'
However, when I change the function to open()
, it works well.
I want to know "why?"
from docx import Document
import os
document = open('book1.docx')
# document = Document('book1.docx')
print document.read()