I'm trying to do anything considering word document using docx library in python. The problem is, whatever I import, I get error message about 'no attribute'. For eample - Document
from docx import Document
gives output
cannot import name Document
and any try to use Document ends with error
AttributeError: 'module' object has no attribute 'Document'
Any syntax seems to be correct. I'm using docx module version 0.2.4 .
Thanks for all help.
I had a similar problem. I had used pip install docx in my virtual environment. The fix was to pip uninstall docx and then pip install python-docx.
from official documentation
python-docx versions 0.3.0 and later are not API-compatible with prior versions.
so, try to update package or use old api
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With