Problem Description
I discovered this error while incubating the litestar-docs-l10n project.
When using the gettext builder to generate .pot files for the v2 documentation (e.g., the v2.19.0 tag), it eventually results in the following error message:
Traceback
=========
File "/media/hwhsu1231/KubuntuData/Repo/testing/litestar-v2.19.0/.conda/lib/python3.12/site-packages/sphinx/events.py", line 415, in emit
raise ExtensionError(
sphinx.errors.ExtensionError: Handler <function overwrite_pygments_css at 0x7d120ecec180> for event 'build-finished' threw an exception (exception: [Errno 2] No such file or directory:
'/media/hwhsu1231/KubuntuData/Repo/testing/litestar-v2.19.0/docs/_build/gettext/_static/pygments.css')
Proposed Solutions
I found the root cause and a solution to this error at PyData Issues:
pydata/pydata-sphinx-theme#1840
The error seems to be caused by adding pydata_sphinx_theme to the extensions list.
Therefore, the solution is either to comment out or remove the line app.setup_extension("pydata_sphinx_theme"):
|
app.setup_extension("pydata_sphinx_theme") |
Or to add a condition app.builder.name == "gettext" within the delayed_setup() function:
if app.builder.name == "linkcheck" or app.builder.name == "gettext":
return
Additional Information
To reproduce the error, run the following commands:
# Clone the repository
VERSION=v2.19.0
git clone --depth=1 --branch=${VERSION} https://github.com/litestar-org/litestar.git litestar-${VERSION}
cd litestar-${VERSION}
# Install dependencies
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install conda-forge::python=3.12 conda-forge::uv --yes
export PYTHONNOUSERSITE=1 LANG=en_US.UTF-8 LANGUAGE=en_US
uv export --python $(which python) --format requirements.txt --output-file requirements.txt
uv pip install --python $(which python) --requirement requirements.txt
# Build with html builder: SUCCESS!
BUILDER=html
mkdir -p docs/_build/${BUILDER}
sphinx-build -b ${BUILDER} docs docs/_build/${BUILDER}
# Build with gettext builder: FAILED!
BUILDER=gettext
mkdir -p docs/_build/${BUILDER}
sphinx-build -b ${BUILDER} docs docs/_build/${BUILDER}
Problem Description
I discovered this error while incubating the litestar-docs-l10n project.
When using the gettext builder to generate
.potfiles for the v2 documentation (e.g., thev2.19.0tag), it eventually results in the following error message:Proposed Solutions
I found the root cause and a solution to this error at PyData Issues:
pydata/pydata-sphinx-theme#1840
The error seems to be caused by adding
pydata_sphinx_themeto theextensionslist.Therefore, the solution is either to comment out or remove the line
app.setup_extension("pydata_sphinx_theme"):litestar/docs/conf.py
Line 364 in 4a4a544
Or to add a condition
app.builder.name == "gettext"within thedelayed_setup()function:Additional Information
To reproduce the error, run the following commands: