Open sylvestre opened 1 week ago
@sylvestre are you able to run with --pdb
or insert a statement to print(f'{self.srcdir=}')
?
srcdir
should be a _StrPath
instance, I wonder if one of your extensions is overwriting it to be a str
, which would cause the TypeError
you're seeing.
We do have test converage for this particular warning, so I don't think it's an issue with Sphinx in the first instance.
An easy reproduction case would be a sample index.rst
:
Test
====
.. image:: test.png
and your current conf.py
with the following added:
from pathlib import Path
IMG_PATH = Path('test.png')
def handler(app):
assert IMG_PATH.exists()
IMG_PATH.unlink()
return []
def setup(app):
IMG_PATH.touch()
app.connect('html-collect-pages', handler)
When running this locally (sphinx-build -M html . build -T
) I get the expected warning and no TypeError
-- if you are getting the TypeError
, can you try incrementally removing your extensions until no error occurs.
A
Indeed, seems to be an str:
(Pdb) print(f'{self.srcdir=}')
self.srcdir='/home/sylvestre/dev/mozilla/mozilla-unified.hg/obj-x86_64-pc-linux-gnu/docs/html/_staging'
@AA-Turner I'm not an expert but from reading thousands of threads on SO this segment to me is synonymous to trouble:
python3.12/site-packages
@sylvestre I'm not a Linux user but the above suggests you've installed Sphinx to a Python base installation (the kind that's a default and comes pre-installed with an OS)? Both in Windows and Linux this is known to cause inexplicable problems and a solution might be to install Sphinx to a clean venv and activate it to build the docs. Otherwise Python installations that aren't clean can be non-standard and cause all kinds of problems.
Describe the bug
Trying to upgrade Firefox doc to version 8.1.2, I am getting this exception. it could be catch to provide a better error message. I guess it is because a file is missing
How to Reproduce
Quite complex for now
Environment Information
Sphinx extensions
No response
Additional context
No response