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 encountered in extlinks.py #11094

Closed
aburrell opened this issue Jan 5, 2023 · 10 comments
Closed

TypeError encountered in extlinks.py #11094

aburrell opened this issue Jan 5, 2023 · 10 comments

Comments

@aburrell
Copy link

aburrell commented Jan 5, 2023

Describe the bug

In Sphinx 6.1.1 (works fine in 5.3.0 and 4.0.3), a TypeError is raised on line 103 of sphinx/ext/extlinks.py when building documentation. The error occurs here: https://github.com/aburrell/apexpy/actions/runs/3850865270/jobs/6561478581#step:5:59

How to Reproduce

Using the docs from: https://github.com/aburrell/apexpy, run: sphinx-build -E -b html docs dist/docs from the home directory of that project. This was tested with Python 3.9 on Ubuntu (ubuntu-latest, GitHub Actions).

Environment Information

Don't know how to access the error log, but here's the output:

Running Sphinx v6.1.1
making output directory... done
[autosummary] generating autosummary for: api.rst, authors.rst, changelog.rst, contributing.rst, ex_index.rst, examples/ex_apexh.rst, examples/ex_cli.rst, examples/ex_gc.rst, examples/ex_init.rst, index.rst, installation.rst, maintenance.rst, readme.rst
[AutoAPI] Reading files... [ 11%] /home/runner/work/apexpy/apexpy/apexpy/__init__.py
[AutoAPI] Reading files... [ 22%] /home/runner/work/apexpy/apexpy/apexpy/__main__.py
[AutoAPI] Reading files... [ 33%] /home/runner/work/apexpy/apexpy/apexpy/_gcc_build_bitness.py
[AutoAPI] Reading files... [ 44%] /home/runner/work/apexpy/apexpy/apexpy/apex.py
[AutoAPI] Reading files... [ 55%] /home/runner/work/apexpy/apexpy/apexpy/helpers.py
[AutoAPI] Reading files... [ 66%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_Apex.py
[AutoAPI] Reading files... [ 77%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_fortranapex.py
[AutoAPI] Reading files... [ 88%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_cmd.py
[AutoAPI] Reading files... [100%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_helpers.py

[AutoAPI] Mapping Data... [ 11%] /home/runner/work/apexpy/apexpy/apexpy/__init__.py
[AutoAPI] Mapping Data... [ 22%] /home/runner/work/apexpy/apexpy/apexpy/__main__.py
[AutoAPI] Mapping Data... [ 33%] /home/runner/work/apexpy/apexpy/apexpy/_gcc_build_bitness.py
[AutoAPI] Mapping Data... [ 44%] /home/runner/work/apexpy/apexpy/apexpy/apex.py
[AutoAPI] Mapping Data... [ 55%] /home/runner/work/apexpy/apexpy/apexpy/helpers.py
[AutoAPI] Mapping Data... [ 66%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_Apex.py
[AutoAPI] Mapping Data... [ 77%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_fortranapex.py
[AutoAPI] Mapping Data... [ 88%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_cmd.py
[AutoAPI] Mapping Data... [100%] /home/runner/work/apexpy/apexpy/apexpy/tests/test_helpers.py

[AutoAPI] Rendering Data... [ 11%] apexpy
[AutoAPI] Rendering Data... [ 22%] apexpy.__main__
[AutoAPI] Rendering Data... [ 33%] apexpy._gcc_build_bitness
[AutoAPI] Rendering Data... [ 44%] apexpy.apex
[AutoAPI] Rendering Data... [ 55%] apexpy.helpers
[AutoAPI] Rendering Data... [ 66%] test_Apex
[AutoAPI] Rendering Data... [ 77%] test_fortranapex
[AutoAPI] Rendering Data... [ 88%] test_cmd
[AutoAPI] Rendering Data... [100%] test_helpers

building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 13 source files that are out of date
updating environment: [new config] 23 added, 0 changed, 0 removed
reading sources... [  4%] api

Exception occurred:
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/sphinx/ext/extlinks.py", line 103, in role
    title = caption % part
TypeError: not all arguments converted during string formatting
The full traceback has been saved in /tmp/sphinx-err-gbrkq2pv.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Error: Process completed with exit code 2.
@AA-Turner
Copy link
Member

AA-Turner commented Jan 6, 2023

EDIT

This was removed in #10471, though you should have seen warnings (permalink from the commit before removal of the functionality):

try:
base_url % 'dummy'
except (TypeError, ValueError):
logger.warn(__('extlinks: Sphinx-6.0 will require base URL to '
'contain exactly one \'%s\' and all other \'%\' need '
'to be escaped as \'%%\'.')) # RemovedInSphinx60Warning
base_url = base_url.replace('%', '%%') + '%s'
if caption is not None:
try:
caption % 'dummy'
except (TypeError, ValueError):
logger.warning(__('extlinks: Sphinx-6.0 will require a caption string to '
'contain exactly one \'%s\' and all other \'%\' need '
'to be escaped as \'%%\'.')) # RemovedInSphinx60Warning
caption = caption.replace('%', '%%') + '%s'

To fix the error, ensure that there is a single %s in both fields, or that they are None. For example, change

extlinks = {"pypi": ("https://pypi.org/project/%s", "")}

to

extlinks = {"pypi": ("https://pypi.org/project/%s", "%s")}

or

extlinks = {"pypi": ("https://pypi.org/project/%s", None)}

Please also see the documentation for help: https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html

A

@aburrell

This comment was marked as outdated.

@stmlange

This comment was marked as outdated.

@lyonels

This comment was marked as off-topic.

@aburrell
Copy link
Author

Following the instructions I changed extlinks = {'doi': ('http://dx.doi.org/%s', 'doi:')} to extlinks = {'doi': ('http://dx.doi.org/%s', 'doi:%s')} in my conf.py. It may be worth updating the TypeError message to point users to potential issues with their conf.py file extlinks formats.

@bashtage

This comment was marked as outdated.

@andy-maier

This comment was marked as outdated.

bittner added a commit to painless-software/python-cli-test-helpers that referenced this issue Feb 23, 2023
bittner added a commit to painless-software/python-cli-test-helpers that referenced this issue Feb 23, 2023
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
pganssle added a commit to pganssle/zoneinfo that referenced this issue Mar 8, 2023
Apparently there was a change in Sphinx around 6.1.3 that doesn't allow
for the implicit %s substitution at the end of the string. See: sphinx-doc/sphinx#11094
@cynic-1

This comment was marked as outdated.

@AA-Turner

This comment was marked as outdated.

@AA-Turner
Copy link
Member

Closing this as it was an intended change, please comment if there are further issues that are not solved by the suggested changes above.

A

@AA-Turner AA-Turner closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
jodal added a commit to mopidy/mopidy that referenced this issue Mar 19, 2023
vorsel added a commit to vorsel/jenkins-pipelines that referenced this issue Apr 4, 2023
Downgrade sphinx for OL9 to 5.3.0 due to
sphinx-doc/sphinx#11094
vorsel added a commit to Percona-Lab/jenkins-pipelines that referenced this issue Apr 4, 2023
Downgrade sphinx for OL9 to 5.3.0 due to
sphinx-doc/sphinx#11094
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants