I’m encountering an issue while using Sphinx with the sphinxcontrib.images extension and the docxbuilder to generate DOCX files.
I have files with thumbnails directive. During the build process, I receive the following error:
TypeError: DocxTranslator.visit_image_node() missing 2 required positional arguments: 'alt' and 'get_filepath'
I
I’ve tried adding the function to conf.py as specified in the docxbuilder documentation, but I’m still facing the same error.
Here is a snippet of my conf.py:
def setup(app):
def docx_visit_thumbnail(self, node):
def get_filepath(self, node):
from sphinxcontrib.images import ImageDirective
directive = ImageDirective(self)
filepath = directive.run(self)[0]['uri']
return filepath
alt = node.get('alt', '')
self.visit_image_node(node, alt, get_filepath)
import docxbuilder
translator = docxbuilder.DocxBuilder.default_translator_class
setattr(translator, 'visit_thumbnail', docx_visit_thumbnail)
I’ve looked into the source code of docxbuilder and sphinxcontrib.images, but couldn’t find a way to fix this issue. Has anyone had a similar problem? Can you help me fix it? Thanks!
Fichte is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.