Skip to content

UnboundLocalError due to build123d breaking changes #45

Description

@haroldm

When installing gflabel with pipx install gflabel, trying to generate labels such as gflabel pred "{head(+)} {bolt(50,slotted,round)}\nM3×50" generates the following error:

$ gflabel pred "{head(+)} {bolt(50,slotted,round)}\nM3×50"
Rendering label with width: 1 u
Rendering line 1 ("{head(+)} {bolt(50,slotted,round)}")
Traceback (most recent call last):
  File "/Users/harold/.local/bin/gflabel", line 6, in <module>
    sys.exit(run())
             ^^^^^
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/cli.py", line 371, in run
    render_divided_label(
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/label.py", line 325, in render_divided_label
    add(renderer.render(label, area_per_label))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/label.py", line 139, in render
    self._do_multiline_render(
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/label.py", line 179, in _do_multiline_render
    self._render_single_line(
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/label.py", line 284, in _render_single_line
    render = frag.render(
             ^^^^^^^^^^^^
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/gflabel/fragments.py", line 597, in render
    _head = EllipticalCenterArc((-hw + lw, 0), lw, head_h, 90, -90)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harold/.local/pipx/venvs/gflabel/lib/python3.12/site-packages/build123d/objects_curve.py", line 1202, in __init__
    angular_direction=direction,  # pylint: disable=possibly-used-before-assignment
                      ^^^^^^^^^
UnboundLocalError: cannot access local variable 'direction' where it is not associated with a value

This seems to be due to the following change in build123d v0.11.0:

EllipticalCenterArc.end_angle is deprecated in favor of arc_size

Downgrading to build123d 0.10.0 (pipx runpip gflabel install "build123d==0.10.0") fixes the issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions