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

[Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist #87944

Closed
vstinner opened this issue Apr 8, 2021 · 3 comments
Labels
3.10 only security fixes docs Documentation in the Doc dir

Comments

@vstinner
Copy link
Member

vstinner commented Apr 8, 2021

BPO 43778
Nosy @vstinner
PRs
  • bpo-43778: Fix Sphinx glossary_search extension #25286
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-04-08.22:08:42.782>
    created_at = <Date 2021-04-08.20:31:24.671>
    labels = ['3.10', 'docs']
    title = "[Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist"
    updated_at = <Date 2021-04-08.22:08:42.781>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2021-04-08.22:08:42.781>
    actor = 'vstinner'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-04-08.22:08:42.782>
    closer = 'vstinner'
    components = ['Documentation']
    creation = <Date 2021-04-08.20:31:24.671>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43778
    keywords = ['patch']
    message_count = 3.0
    messages = ['390552', '390558', '390560']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'docs@python']
    pr_nums = ['25286']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43778'
    versions = ['Python 3.10']

    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 8, 2021

    Doc/tools/extensions/glossary_search.py failed multiple times on my doc PR:
    #25283

    The fail is not deterministic (random error, timing issue?), it depends if the directory was already created by something else or not.

    Error on the Docs PR job of the Azure Pipeline:
    --------------
    2021-04-08T17:55:57.7774293Z writing output... [ 98%] whatsnew/3.5
    2021-04-08T17:55:58.0531588Z writing output... [ 98%] whatsnew/3.6
    2021-04-08T17:55:58.3085384Z writing output... [ 99%] whatsnew/3.7
    2021-04-08T17:55:58.5638166Z writing output... [ 99%] whatsnew/3.8
    2021-04-08T17:55:59.3385073Z writing output... [ 99%] whatsnew/3.9
    2021-04-08T17:55:59.5205350Z writing output... [ 99%] whatsnew/changelog
    2021-04-08T17:56:02.4282200Z writing output... [100%] whatsnew/index
    2021-04-08T17:56:03.1454692Z
    2021-04-08T17:56:03.1463636Z Writing glossary.json
    2021-04-08T17:56:03.1466614Z
    2021-04-08T17:56:03.1467473Z Exception occurred:
    2021-04-08T17:56:03.3286028Z File "/home/vsts/work/1/s/Doc/tools/extensions/glossary_search.py", line 49, in on_build_finish
    2021-04-08T17:56:03.3287379Z with open(path.join(app.outdir, '_static', 'glossary.json'), 'w') as f:
    2021-04-08T17:56:03.3288351Z FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/1/s/Doc/build/html/_static/glossary.json'
    2021-04-08T17:56:03.3294489Z The full traceback has been saved in /tmp/sphinx-err-1c8jemiu.log, if you want to report the issue to the developers.
    2021-04-08T17:56:03.3295501Z Please also report this if it was a user error, so that a better error message can be provided next time.
    2021-04-08T17:56:03.3296536Z A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues\>. Thanks!
    --------------
    https://dev.azure.com/Python/cpython/_build/results?buildId=78035&view=results

    Error on Travis CI:
    --------------
    PATH=./venv/bin:$PATH sphinx-build -b html -d build/doctrees -q -W -j4 -W . build/html

    Extension error:

    Handler <function on_build_finish at 0x7f6ed4c6abf8> for event 'build-finished' threw an exception (exception: [Errno 2] No such file or directory: '/home/travis/build/python/cpython/Doc/build/html/_static/glossary.json')

    Makefile:49: recipe for target 'build' failed
    --------------
    https://travis-ci.com/github/python/cpython/jobs/497108477

    Attached PR fix the extension: create the directory if it doesn't exists.

    @vstinner vstinner added the 3.10 only security fixes label Apr 8, 2021
    @vstinner vstinner added docs Documentation in the Doc dir 3.10 only security fixes labels Apr 8, 2021
    @vstinner vstinner added the docs Documentation in the Doc dir label Apr 8, 2021
    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 8, 2021

    New changeset f32d022 by Victor Stinner in branch 'master':
    bpo-43778: Fix Sphinx glossary_search extension (GH-25286)
    f32d022

    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 8, 2021

    Python 3.9 is not affected, this Sphinx extension is new in Python 3.10. By the way, I like this feature!

    The new " Glossary: borrowed reference " block in:

    https://docs.python.org/3.10/search.html?q=borrowed+reference

    @vstinner vstinner closed this as completed Apr 8, 2021
    @vstinner vstinner closed this as completed Apr 8, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant