pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

RuntimeError: absolute path '.../dataclasses.py' is not a descendant of the current working directory or of the system's python library

Open Lucas-C opened this issue 9 months ago • 1 comments

Hi.

In fpdf2 we have been using pdoc3 for several years: thank you for maintaining this great tool!

I noticed a warning in our execution log: https://github.com/py-pdf/fpdf2/actions/runs/13482969652/job/37670544099?pr=1374

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/pdoc/html_helpers.py", line 569, in format_git_link
    path = _project_relative_path(abs_path)
  File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/pdoc/html_helpers.py", line 635, in _project_relative_path
    raise RuntimeError(
    ...<2 lines>...
    )
RuntimeError: absolute path '/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/dataclasses.py' is not a descendant of the current working directory or of the system's python library.

I do not quite understand the origin of this stacktrace, but I suspect that's maybe due to this usage of dataclasses.replace as a method: https://github.com/py-pdf/fpdf2/blob/2.8.2/fpdf/fonts.py#L75

Do you know how we could prevent this error to be raised?

Lucas-C avatar Feb 23 '25 12:02 Lucas-C

https://github.com/pdoc3/pdoc/blob/9e4f6ad4b311f267648aa1533487a17c8b124f93/pdoc/html_helpers.py#L628-L638

The question seems to be, why isn't '/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/' recognized/configured as 'platlib' path.

kernc avatar Feb 24 '25 00:02 kernc