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

UnboundLocalError: local variable 'noqa' referenced before assignment #10579

Closed
tkoyama010 opened this issue Jun 19, 2022 · 0 comments
Closed

Comments

@tkoyama010
Copy link
Contributor

tkoyama010 commented Jun 19, 2022

Describe the bug

The following error occurred in sphinx when using the internationalization feature to HTML content in rst file.
Content:

.. raw:: html

  <table class="contentstable" align="center" style="margin-left: 30px"><tr>
    <td width="45%" rowspan="4">
      <img alt="Mayavi banner" src="_static/m2_about.jpg" 
            width="100%" />
    </td>
    <td width="5%" rowspan="4"></td>
    <td width="50%">
      <p class="biglink"><a class="biglink" href="application.html">
                Using the Mayavi application</a><br/>
         <span class="linkdescr">
                Understanding and using the Mayavi interactive application</span></p>
    </td></tr><tr><td width="50%">
      <p class="biglink"><a class="biglink" href="mlab.html">
        Python scripting for 3D plotting</a><br/>
         <span class="linkdescr">The simple scripting API to Mayavi</span></p>
    </td></tr><tr><td width="50%">
      <p class="biglink"><a class="biglink" href="auto/examples.html">
        Gallery and examples</a><br/>
         <span class="linkdescr">
            Example gallery of visualizations, 
            with the Python code that generates them</span></p>
    </td></tr>
  </table>

Error:

  File "/usr/local/lib/python3.9/site-packages/sphinx/transforms/i18n.py", line 320, in apply
    if not noqa and len(old_foot_refs) != len(new_foot_refs):
UnboundLocalError: local variable 'noqa' referenced before assignment

Exception occurred:
  File "/usr/local/lib/python3.9/site-packages/sphinx/transforms/i18n.py", line 320, in apply
    if not noqa and len(old_foot_refs) != len(new_foot_refs):
UnboundLocalError: local variable 'noqa' referenced before assignment
The full traceback has been saved in /tmp/sphinx-err-se8e55i6.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!
make: *** [Makefile:2: all] Error 2

How to Reproduce

FROM python:3.9-slim
RUN apt update; apt install -y git make
RUN git clone https://github.com/tkoyama010/mayavi-doc-translations
WORKDIR /mayavi-doc-translations
RUN git checkout 2cfddb290ca429fd720334115ba95e66c271a63a
RUN pip install -r requirements.txt
RUN make

Expected behavior

Build without error.

Your project

https://github.com/tkoyama010/mayavi-doc-translations

Screenshots

No response

OS

Ubuntu22.04

Python version

3.9

Sphinx version

4.5.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added this to the 5.1.0 milestone Jun 19, 2022
tk0miya added a commit that referenced this issue Jun 26, 2022
Fix #10579: i18n: UnboundLocalError is raised on translating raw directive
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants