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

TypeError: can only concatenate str (not "_StrPath") to str #262

Closed
Remi-Gau opened this issue Aug 17, 2024 · 3 comments
Closed

TypeError: can only concatenate str (not "_StrPath") to str #262

Remi-Gau opened this issue Aug 17, 2024 · 3 comments

Comments

@Remi-Gau
Copy link
Collaborator

Getting a new error that seems to be due to a new sphinx release as this does now happen with sphinx < 8.

Affected project: https://github.com/cpp-lln-lab/bidspm

Steps to reproduce at the time of reporting

git clone https://github.com/cpp-lln-lab/bidspm
cd bidspm
pip install .[doc]
make -C docs html

By the way: not sure why the error log shows: sphinxcontrib.matlab (unknown version)

Suggested fix: casting this line to a string fixed it for me.

+ self.env.doc2path(objects[fullname_out][0])

            if fullname_out in objects:
                self.state_machine.reporter.warning(
                    "duplicate object description of %s, " % fullname_out
                    + "other instance in "
                    + str(self.env.doc2path(objects[fullname_out][0]))
                    + ", use :noindex: for one of them",
                    line=self.lineno,
                )
ERROR LOG # Platform: linux; (Linux-6.8.0-40-generic-x86_64-with-glibc2.35) # Sphinx version: 8.0.2 # Python version: 3.12.3 (CPython) # Docutils version: 0.21.2 # Jinja2 version: 3.1.4 # Pygments version: 2.18.0

Last messages:

building [mo]: targets for 0 po files that are out of date

writing output...

building [html]: targets for 0 source files that are out of date

updating environment:

locale_dir /home/remi/github/cpp-lln-lab/bidspm/docs/source/locales/en/LC_MESSAGES does not exist

0 added, 8 changed, 0 removed

reading sources... [ 12%]

API

Loaded extensions:

sphinx.ext.mathjax (8.0.2)

alabaster (1.0.0)

sphinxcontrib.applehelp (2.0.0)

sphinxcontrib.devhelp (2.0.0)

sphinxcontrib.htmlhelp (2.1.0)

sphinxcontrib.serializinghtml (2.0.0)

sphinxcontrib.qthelp (2.0.0)

sphinx.ext.intersphinx (8.0.2)

sphinx.ext.autodoc.preserve_defaults (8.0.2)

sphinx.ext.autodoc.type_comment (8.0.2)

sphinx.ext.autodoc.typehints (8.0.2)

sphinx.ext.autodoc (8.0.2)

sphinx.ext.coverage (8.0.2)

sphinxcontrib.matlab (unknown version)

sphinxcontrib.mermaid (8.0.2)

sphinxcontrib.bibtex (2.6.2)

sphinx_copybutton (0.5.2)

sphinx_togglebutton (0.3.2)

myst_parser (4.0.0)

sphinxarg.ext (0.5.2)

pydata_sphinx_theme (unknown version)

Traceback:

Traceback (most recent call last):
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/cmd/build.py", line 337, in build_main
app.build(args.force_all, args.filenames)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/application.py", line 378, in build
self.builder.build_update()
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/builders/init.py", line 296, in build_update
self.build(to_build,
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/builders/init.py", line 317, in build
updated_docnames = set(self.read())
^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/builders/init.py", line 424, in read
self._read_serial(docnames)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/builders/init.py", line 476, in _read_serial
self.read_doc(docname)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/builders/init.py", line 535, in read_doc
publisher.publish()
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/core.py", line 234, in publish
self.document = self.reader.read(self.source, self.parser,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/io.py", line 106, in read
self.parse()
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/readers/init.py", line 76, in parse
self.parser.parse(self.input, document)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/parsers.py", line 83, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 169, in run
results = StateMachineWS.run(self, input_lines, input_offset,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 233, in run
context, next_state, result = self.check_line(
^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 445, in check_line
return method(match, context, next_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2790, in underline
self.section(title, source, style, lineno - 1, messages)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 325, in section
self.new_subsection(title, lineno, messages)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
newabsoffset = self.nested_parse(
^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
state_machine.run(block, input_offset, memo=self.memo,
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 195, in run
results = StateMachineWS.run(self, input_lines, input_offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 233, in run
context, next_state, result = self.check_line(
^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 445, in check_line
return method(match, context, next_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2790, in underline
self.section(title, source, style, lineno - 1, messages)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 325, in section
self.new_subsection(title, lineno, messages)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
newabsoffset = self.nested_parse(
^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
state_machine.run(block, input_offset, memo=self.memo,
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 195, in run
results = StateMachineWS.run(self, input_lines, input_offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 233, in run
context, next_state, result = self.check_line(
^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 445, in check_line
return method(match, context, next_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2357, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2369, in explicit_construct
return method(self, expmatch)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2106, in directive
return self.run_directive(
^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2156, in run_directive
result = directive_instance.run()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/domains/init.py", line 291, in run
return super().run()
^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinxcontrib/mat_directives.py", line 96, in run
result = parse_generated_content(self.state, params.result, documenter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/ext/autodoc/directive.py", line 91, in parse_generated_content
return nested_parse_to_nodes(state, content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/util/parsing.py", line 65, in nested_parse_to_nodes
state.nested_parse(content, offset, node, match_titles=allow_section_headings)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
state_machine.run(block, input_offset, memo=self.memo,
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 195, in run
results = StateMachineWS.run(self, input_lines, input_offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 233, in run
context, next_state, result = self.check_line(
^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/statemachine.py", line 445, in check_line
return method(match, context, next_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2357, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2369, in explicit_construct
return method(self, expmatch)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2106, in directive
return self.run_directive(
^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/docutils/parsers/rst/states.py", line 2156, in run_directive
result = directive_instance.run()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/domains/init.py", line 291, in run
return super().run()
^^^^^^^^^^^^^
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinx/directives/init.py", line 280, in run
self.add_target_and_index(name, sig, signode)
File "/home/remi/github/cpp-lln-lab/bidspm/env/lib/python3.12/site-packages/sphinxcontrib/matlab.py", line 288, in add_target_and_index
"duplicate object description of %s, " % fullname_out
TypeError: can only concatenate str (not "_StrPath") to str

@joeced
Copy link
Collaborator

joeced commented Aug 17, 2024

Thanks for the report and the solution. Fixed in version 0.22.1.

@joeced
Copy link
Collaborator

joeced commented Aug 17, 2024

And created #264 to fix the missing version number.

@Remi-Gau
Copy link
Collaborator Author

Thanks for the report and the solution. Fixed in version 0.22.1.

thanks for the super speedy release !!! 😍

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

No branches or pull requests

2 participants