I'm using the following code:
from docx import Document
d = Document(open("arquivo.docx"))
This code works on Ubuntu but does not work on windows.
In windows I have the return in the terminal:
Traceback (most recent call last): File "Default2.py", line 94, in dialog d = Document (f)
File "C: \ Python27 \ lib \ site-packages \ docx \ api.py", line 35, in init document_part, package = self._open (docx)
File "C: \ Python27 \ lib \ site-packages \ docx \ api.py", line 193, in _open package = Package.open (docx)
File "C: \ Python27 \ lib \ site-packages \ docx \ opc \ package.py", line 116, in open pkg_reader = PackageReader.from_file (pkg_file)
File "C: \ Python27 \ lib \ site-packages \ docx \ opc \ pkgreader.py", line 32, in from_f ile
phys_reader = PhysPkgReader (pkg_file) File "C: \ Python27 \ lib \ site-packages \ docx \ opc \ phys_pkg.py", line 101, in __init __ self._zipf = ZipFile (pkg_file, 'r')
File "C: \ Python27 \ lib \ zipfile.py", line 793, in init self._RealGetContents ()
File "C: \ Python27 \ lib \ zipfile.py", line 860, in _RealGetContents raise BadZipfile ("Truncated central directory") zipfile.BadZipfile: Truncated central directory
The full code is on this link