Skip to content Skip to sidebar Skip to footer

Docx Missing Attributes

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

Solution 1:

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.


Solution 2:

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


Solution 3:

are you sure you properly installed docx? Because it seems it is not installed. You should try using pip or easy_install to install it properly.

http://python-docx.readthedocs.org/en/latest/user/install.html

For example, I never installed it and I get this following code error if I try to import it which is pretty much what you get :

Traceback (most recent call last):
  File "docx.py", line 1, in <module>
  from docx import Document
File "/Users/xxxx/Documents/Python/docx.py", line 1, in <module>
from docx import Document
ImportError: cannot import name Document

Post a Comment for "Docx Missing Attributes"