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

Menu KeyError #487

Open
Frag1337 opened this issue Jul 18, 2023 · 3 comments
Open

Menu KeyError #487

Frag1337 opened this issue Jul 18, 2023 · 3 comments

Comments

@Frag1337
Copy link
Contributor

Hi, my console is ocassionaly filled with these. Not sure how to reproduce that. Maybe it has something to do with sourcemod menu's clashing?

Traceback (most recent call last):
  File "/home/cssserver1/serverfiles/cstrike/addons/source-python/packages/source-python/commands/auth.py", line 44, in __call__
    return self.callback(*args)
  File "/home/cssserver1/serverfiles/cstrike/addons/source-python/packages/source-python/menus/queue.py", line 267, in _menuselect_callback
    _radio_queues[index]._select(choice)
  File "/home/cssserver1/serverfiles/cstrike/addons/source-python/packages/source-python/menus/queue.py", line 126, in _select
    next_menu = active_menu._select(self._index, choice)
  File "/home/cssserver1/serverfiles/cstrike/addons/source-python/packages/source-python/menus/radio.py", line 113, in _select
    self._player_pages[player_index].options[choice_index])
KeyError: 3
@Ayuto
Copy link
Member

Ayuto commented Jul 18, 2023

Yes, this is likely a conflict with another server plugin. Could be difficult to fix.

@srpg
Copy link
Contributor

srpg commented Jul 18, 2023

I get those errors randomly aswell, even i though only have installed sp and only use sp plugins i made

@jordanbriere
Copy link
Contributor

These happens when the menuselect command is issued directly through the console (e.g. through a bind) with an option that is not valid for the current page. For example:

from menus import *
from players.entity import *

SimpleMenu(['...',]).send(1)
Player(1).client_command('menuselect 3', True)

"""
[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\packages\source-python\commands\auth.py", line 44, in __call__
    return self.callback(*args)
  File "..\addons\source-python\packages\source-python\menus\queue.py", line 267, in _menuselect_callback
    _radio_queues[index]._select(choice)
  File "..\addons\source-python\packages\source-python\menus\queue.py", line 126, in _select
    next_menu = active_menu._select(self._index, choice)
  File "..\addons\source-python\packages\source-python\menus\radio.py", line 113, in _select
    self._player_pages[player_index].options[choice_index])

KeyError: 3
"""

Passing no value is also producing an error:

from menus import *
from players.entity import *

SimpleMenu(['...',]).send(1)
Player(1).client_command('menuselect', True)

"""
[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\packages\source-python\commands\auth.py", line 44, in __call__
    return self.callback(*args)
  File "..\addons\source-python\packages\source-python\menus\queue.py", line 265, in _menuselect_callback
    index, choice = _validate_selection(command, index, VALID_CHOICES)
  File "..\addons\source-python\packages\source-python\menus\queue.py", line 221, in _validate_selection
    choice = int(command[1])

IndexError: Index out of range.
"""

f3272be addresses those contexts.

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

No branches or pull requests

4 participants