Skip to content

UnboundLocalError: local variable 's' referenced before assignment #1016

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

Closed
NikolaiVChr opened this issue Jun 29, 2024 · 2 comments · Fixed by #1021
Closed

UnboundLocalError: local variable 's' referenced before assignment #1016

NikolaiVChr opened this issue Jun 29, 2024 · 2 comments · Fixed by #1021
Assignees
Labels
Milestone

Comments

@NikolaiVChr
Copy link

NikolaiVChr commented Jun 29, 2024

When mouse clicking in root locus plot outside in the border region of the window I get this:

Traceback (most recent call last):
  File "C:\Users\me\PycharmProjects\f\venv\lib\site-packages\matplotlib\cbook.py", line 298, in process
    func(*args, **kwargs)
  File "C:\Users\me\PycharmProjects\f\venv\lib\site-packages\control\pzmap.py", line 470, in _click_dispatcher
    K, s = _find_root_locus_gain(event, sys, ax)
  File "C:\Users\me\PycharmProjects\f\venv\lib\site-packages\control\pzmap.py", line 531, in _find_root_locus_gain
    return None, s
UnboundLocalError: local variable 's' referenced before assignment
@murrayrm
Copy link
Member

This worked OK for me on the main branch with Python 3.12 and matplotlib 3.8.4 using iPython.

Can you post the versions of Python, control and matplotlib that you are using, along with the execution environment (python, iPython, Jupyter) that you are using, so we can narrow things down?

@NikolaiVChr
Copy link
Author

NikolaiVChr commented Jun 30, 2024

Control v0.10.0
Numpy 1.26.4
Scipy 1.14.0
matplotlib 2.9.0
PyCharm 2023.2.3
Python 3.10

Python env

@murrayrm murrayrm self-assigned this Jun 30, 2024
@murrayrm murrayrm added the bug label Jun 30, 2024
@murrayrm murrayrm added this to the 0.10.1 milestone Jun 30, 2024
murrayrm added a commit to murrayrm/python-control that referenced this issue Jun 30, 2024
murrayrm added a commit that referenced this issue Jul 7, 2024
fix bug in root_locus_plot identified by @NikolaiVChr in issue #1016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants