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

Fix UnboundLocalError raised when Device is attached to a Group-Track #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ryannikolaidis
Copy link

@ryannikolaidis ryannikolaidis commented Mar 25, 2024

Fixes #42

When scanning a file / set tracks are iterated and handled differently based on the is_foldable field. In the case where it foldable it is locally defined as group and in the case where it isn't it is defined as track. Later in the function it is assumed that track is already defined. However this won't be the case if the track was foldable / was a group. As a result the follow error is raised:

                for device_index, device_data in enumerate(track_data["devices"]):
>                   device = Device(track, device_index, device_data["name"])
E                   UnboundLocalError: local variable 'track' referenced before assignment

To reproduce: add a device to a Group and then try to instantiate a Set with scan=True

Changes

  • Rename the local group instance to track (it is technically a track and this resolves the unbound issue since it will then be defined later in the function)
  • Adds an EQ Device to the first Group track in the Tests.als file. (see note below about Live version of the Tests.als file)

Testing

With the updated Tests.als file (and without this fix) the current tests will break when the Set fixture attempts to init with scan=True. With this fix, the issue is resolved.

NOTE: I'm on Live 12.0.1 and as such am only able to save the Tests.als as a v12 Live file. If we're not comfortable bumping, someone may need to apply my change and save in the current v11 edition.

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

Successfully merging this pull request may close these issues.

UnboundLocalError raised when Device is attached to a Group-Track
1 participant