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

Assertion error #78

Open
svartkanin opened this issue Jun 22, 2023 · 2 comments
Open

Assertion error #78

svartkanin opened this issue Jun 22, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@svartkanin
Copy link

Apologies in advance as I'm struggling to create a minimal example that reproduces this error, regardless I'll file a bug report as it may be clearer to the author what's going on.

...
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/simple_term_menu.py", line 1598, in show
    self._clear_menu()
  File "/home/dan/Git/archinstall/.venv/lib/python3.11/site-packages/simple_term_menu.py", line 1441, in _clear_menu
    assert self._previous_displayed_menu_height is not None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

It seems that the assertion on line 1441 is failing as the _previous_displayed_menu_height variable is None.
I did search the code for the usage and I could find only a single place where it's actually assigned which is on line 1435.
The function this assignment happens in doesn't seem to be used anywhere though?

@IngoMeyer441
Copy link
Owner

IngoMeyer441 commented Jun 22, 2023

Could you please append a code example which produces this error message? Sorry, I didn't read your message carefully enough.

The error is a bit odd because the assignment is executed in the _paint_menu method, which must be called before the menu is cleared. This is the reason why an assertion is used in line 1441. The condition must always be true, otherwise the internal program logic has a bug.

@IngoMeyer441
Copy link
Owner

Hmm, maybe another errors causes a skip of _paint_menu. _clear_menu is always called, because it is in a finally block (line 1598).

@IngoMeyer441 IngoMeyer441 added the bug Something isn't working label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants