Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'PosixPath' object has no attribute 'rstrip' in breathe/project.py #944

Open
olivierbichler-cea opened this issue Aug 22, 2023 · 4 comments · May be fixed by #964
Open

AttributeError: 'PosixPath' object has no attribute 'rstrip' in breathe/project.py #944

olivierbichler-cea opened this issue Aug 22, 2023 · 4 comments · May be fixed by #964

Comments

@olivierbichler-cea
Copy link

olivierbichler-cea commented Aug 22, 2023

Hi,

I recently got the following error during Sphinx compilation. Everything was working fine a month ago.

Python version: 3.10.12
Sphinx version: 7.2.2

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/sphinx/application.py", line 233, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/sphinx/application.py", line 406, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/sphinx/registry.py", line 460, in load_extension
    metadata = setup(app)
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/breathe/__init__.py", line 12, in setup
    directive_setup(app)
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/breathe/directives/setup.py", line 61, in setup
    project_info_factory = ProjectInfoFactory(app)
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/breathe/project.py", line 116, in __init__
    self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))
AttributeError: 'PosixPath' object has no attribute 'rstrip'

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/eclipse-aidge/envs/latest/lib/python3.10/site-packages/breathe/project.py", line 116, in __init__
    self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))
AttributeError: 'PosixPath' object has no attribute 'rstrip'

Do you have any clue on how to solve this?
Thanks

@olivierbichler-cea
Copy link
Author

Actually, what changed is the version of Sphinx: the issue was not occuring with Sphinx 7.1.2

ranft pushed a commit to ranft/breathe that referenced this issue Aug 22, 2023
@ranft
Copy link

ranft commented Aug 22, 2023

This error is caused by a change in the sphinx API, where the app.doctreedir configuration now is a (pathlib.Path|str) instead of a plain string before. This is the reason, why I do create a new path object in my fix, since I can't be sure what type I actually have there.

@scottamain
Copy link

I'm also seeing this issue. Any hope for a fix in Breathe?

scottamain added a commit to scottamain/breathe that referenced this issue Dec 8, 2023
Just need to cast the path to a string. 

Fixes breathe-doc#944
@scottamain scottamain linked a pull request Dec 8, 2023 that will close this issue
@scottamain
Copy link

This worked for me: #964

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants