sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.61k stars 2.13k forks source link

Running make gettext fails with TypeError #12595

Open SabNK opened 4 months ago

SabNK commented 4 months ago

Describe the bug

When running ./make gettext on Windows, the command fails with TypeError: expected str, bytes or os.PathLike object, not NoneType. (On Linux it works without issue, as well as ./make html is ok)

How to Reproduce

To reproduce this you can clone the repo https://github.com/SabNK/kuwaiba_docs install requirements.txt and then run ./make gettext

Environment Information

# Platform:         win32; (Windows-10-10.0.19045-SP0)
# Sphinx version:   7.3.7
# Python version:   3.10.4 (CPython)
# Docutils version: 0.20.1
# Jinja2 version:   3.0.3
# Pygments version: 2.18.0

# Last messages:
#   writing message catalogs... [100%]
#   docs
#   
#   
#   ====================== slowest reading durations =======================
#   0.531 start/contributing
#   0.031 admin/product_desc
#   0.031 admin/backup
#   0.016 start/contribute/absolute_beginner
#   0.016 start/contribute/documentation

# Loaded extensions:
#   sphinx.ext.mathjax (7.3.7)
#   alabaster (0.7.16)
#   sphinxcontrib.applehelp (1.0.8)
#   sphinxcontrib.devhelp (1.0.6)
#   sphinxcontrib.htmlhelp (2.0.5)
#   sphinxcontrib.serializinghtml (1.1.10)
#   sphinxcontrib.qthelp (1.0.7)
#   sphinx.ext.duration (7.3.7)
#   sphinx.ext.doctest (7.3.7)
#   sphinx.ext.autodoc.preserve_defaults (7.3.7)
#   sphinx.ext.autodoc.type_comment (7.3.7)
#   sphinx.ext.autodoc.typehints (7.3.7)
#   sphinx.ext.autodoc (7.3.7)
#   sphinx.ext.autosummary (7.3.7)
#   sphinx.ext.intersphinx (7.3.7)
#   sphinx_copybutton (0.5.2)
#   myst_parser (3.0.1)
#   sphinxcontrib.jquery (4.1)
#   hoverxref.extension (1.4.0)
#   sphinxcontrib.kroki (1.3.0)
#   sphinxcontrib.youtube (1.4.1)

# Traceback:
Traceback (most recent call last):
  File "C:\SD\Python\P310\lib\site-packages\sphinx\cmd\build.py", line 337, in build_main
    app.build(args.force_all, args.filenames)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\application.py", line 351, in build
    self.builder.build_update()
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\__init__.py", line 293, in build_update
    self.build(to_build,
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\gettext.py", line 267, in build
    super().build(docnames, summary, method)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\__init__.py", line 365, in build
    self.finish()
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\gettext.py", line 290, in finish
    content = GettextRenderer(outdir=self.outdir).render('message.pot_t', context)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\gettext.py", line 116, in render
    return super().render(filename, context)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\util\template.py", line 33, in render
    return self.env.get_template(template_name).render(context)
  File "C:\SD\Python\P310\lib\site-packages\jinja2\environment.py", line 1291, in render
    self.environment.handle_exception()
  File "C:\SD\Python\P310\lib\site-packages\jinja2\environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\templates\gettext\message.pot_t", line 21, in top-level template code
    #: {{ relpath(source) }}:{{ line }}
  File "C:\SD\Python\P310\lib\site-packages\jinja2\sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "C:\SD\Python\P310\lib\site-packages\sphinx\builders\gettext.py", line 113, in _relpath
    return canon_path(relpath(s, self.outdir))
  File "C:\SD\Python\P310\lib\site-packages\sphinx\util\osutil.py", line 131, in relpath
    return os.path.relpath(path, start)
  File "C:\SD\Python\P310\lib\ntpath.py", line 695, in relpath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Sphinx extensions

sphinxcontrib-kroki

Additional context

To my understanding it is caused by sphinxcontrib-kroki used in the file of my repo (see above) /source/start/contributing.rst line 48. If I delete this diagram the command runs ok.

.. kroki:: 
    :caption: Translating BPMN flow
    :filename: /res/start/translate.bpmn
    :type: bpmn
AA-Turner commented 4 months ago

Are you able to create a more minimal reproducer than your entire docs?

A