ImportError: cannot import name 'parse_xml' from 'docx.oxml'
zwgtdev opened this issue · 3 comments
zwgtdev commented
There seems to be an import error related to v1.0.0.0 of python-docx
There are details on the import issue here:
v1.0.0: ImportError: cannot import name 'parse_xml' from 'docx.oxml'
To Reproduce
Seems to be related to the import:
from docxtpl import DocxTemplate, InlineImage
Here is a stacktrace:
File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
mod = importlib.import_module(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
from docxtpl import DocxTemplate, InlineImage
File "/usr/local/lib/python3.11/site-packages/docxtpl/__init__.py", line 13, in <module>
from .subdoc import Subdoc
File "/usr/local/lib/python3.11/site-packages/docxtpl/subdoc.py", line 11, in <module>
from docxcompose.properties import CustomProperties
File "/usr/local/lib/python3.11/site-packages/docxcompose/properties.py", line 9, in <module>
from docx.oxml import parse_xml
ImportError: cannot import name 'parse_xml' from 'docx.oxml' (/usr/local/lib/python3.11/site-packages/docx/oxml/__init__.py)
luca-barbas commented
Also impacted by this bug
ljmf91 commented
i have the same problem
ljmf91 commented
Actually, i retried importing docxtpl and the issue seems to be fixed. until yesterday i was getting a traceback