missionpinball / mpf

Mission Pinball Framework: Open source software to run a real pinball machine.
http://missionpinball.org
MIT License
217 stars 143 forks source link

MPF 0.80.0.dev4 "AssertionError("Specify at least one item to select from")" #1819

Closed solomon-b closed 3 months ago

solomon-b commented 3 months ago

When following the quickstart guide and running mpf -xt i get a runtime exception. I am fetching the latest mpf from the 0.80.x branch.

Ignore the crazy filepaths, I am using nix instead of virtualenv:

➜ mpf -xt
10:54:14.440 : INFO [root] Loading config.
10:54:14.485 : INFO [ConfigProcessor] Config spec file cache created: /tmp/config_spec.mpf_cache
10:54:14.485 : INFO [YamlMultifileConfigLoader] Machine config file #1: config.yaml
10:54:14.485 : INFO [ConfigProcessor] Loading config from cache: /tmp/e264ba4d0cda81de2942d1a83c484255.mpf_cache
10:54:14.530 : INFO [ConfigProcessor] Loading config from cache: /tmp/581ba524431b86a31c61e7ab42fc9931.mpf_cache
10:54:14.531 : INFO [ConfigProcessor] Loading config from cache: /tmp/fa2b8d4cd4a339aa770ad105e5cfa244.mpf_cache
10:54:14.531 : INFO [Machine] Mission Pinball Framework Core Engine v0.80.0.dev4
10:54:14.531 : INFO [Machine] Command line arguments: {'no_load_cache': False, 'create_config_cache': True, 'bcp': True, 'configfile': ['config.yaml'], 'force_assets_load': False, 'platform_integration_test': False, 'jsonlogging': False, 'logfile': 'logs/2024-08-06-10-54-14-mpf-zodiacal-light.log', 'pause': False, 'production': False, 'text_ui': False, 'loglevel': 15, 'consoleloglevel': 20, 'force_platform': 'virtual', 'syslog_address': None, 'full_logfile_path': '/home/solomon/Development/Python/mpf-demo/logs/2024-08-06-10-54-14-mpf-zodiacal-light.log'}
10:54:14.531 : INFO [Machine] MPF path: /nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf
10:54:14.531 : INFO [Machine] Machine path: /home/solomon/Development/Python/mpf-demo
10:54:14.532 : INFO [Machine] Platform: linux
10:54:14.532 : INFO [Machine] Python executable location: /nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/bin/python3.11
10:54:14.532 : INFO [Machine] Python version: 3.11.9 (64-bit)
10:54:14.533 : INFO [Machine] Initializing MPF...
10:54:14.579 : INFO [EventManager] Event: ======'machine_var_credits_string'====== Args={'value': 'FREE PLAY', 'prev_value': None, 'change': True}
10:54:14.589 : INFO [EventManager] Event: ======'machine_var_master_volume'====== Args={'value': 0.5, 'prev_value': None, 'change': True}
10:54:14.589 : INFO [EventManager] Event: ======'machine_var_mpf_version'====== Args={'value': 'Mission Pinball Framework v0.80.0.dev4', 'prev_value': None, 'change': True}
10:54:14.589 : INFO [EventManager] Event: ======'machine_var_mpf_extended_version'====== Args={'value': 'Mission Pinball Framework v0.80.0.dev4, Config version:6, Show version: 6, BCP version:1.1', 'prev_value': None, 'change': True}
10:54:14.589 : INFO [EventManager] Event: ======'machine_var_python_version'====== Args={'value': '3.11.9', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_platform'====== Args={'value': 'Linux-6.8.12-x86_64-with-glibc2.39', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_platform_system'====== Args={'value': 'Linux', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_platform_release'====== Args={'value': '6.8.12', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_platform_version'====== Args={'value': '#1-NixOS SMP PREEMPT_DYNAMIC Thu May 30 07:49:53 UTC 2024', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_platform_machine'====== Args={'value': 'x86_64', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'machine_var_log_file_path'====== Args={'value': '/home/solomon/Development/Python/mpf-demo/logs/2024-08-06-10-54-14-mpf-zodiacal-light.log', 'prev_value': None, 'change': True}
10:54:14.591 : INFO [EventManager] Event: ======'init_phase_1'====== Args={}
10:54:14.597 : INFO [EventManager] Event: ======'init_phase_2'====== Args={}
10:54:14.597 : ERROR [asyncio] Exception in callback EventManager._queue_task_done(<Task finishe...select from')>)
handle: <Handle EventManager._queue_task_done(<Task finishe...select from')>)>
Traceback (most recent call last):
  File "/nix/store/pfv4raslwhi3101k342752v65zxkwrxq-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/events.py", line 795, in _queue_task_done
    future.result()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/events.py", line 708, in _run_handlers_sequential
    handler.callback(queue=queue, **merged_kwargs)
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/mode_controller.py", line 107, in initialize_modes
    mode.initialize_mode()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/mode.py", line 555, in initialize_mode
    self.mode_init()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/modes/carousel/code/carousel.py", line 46, in mode_init
    raise AssertionError("Specify at least one item to select from")
AssertionError: Specify at least one item to select from
10:54:14.599 : INFO [Machine] Starting the main run loop with active modes: []
10:54:14.599 : WARNING [Machine] Attract mode is not active, game will not be playable. Please check your attract mode configuration.
10:54:14.599 : INFO [Machine] Shutting down...
10:54:14.599 : INFO [EventManager] Event: ======'shutdown'====== Args={}
Shutdown because of an exception:
Please install the crash_reporter feature to use the MPF crash reporter.
10:54:15.601 : ERROR [Machine] Runtime Exception
Traceback (most recent call last):
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/machine.py", line 808, in _run_loop
    raise self._exception['exception']
  File "/nix/store/pfv4raslwhi3101k342752v65zxkwrxq-python3-3.11.9/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/events.py", line 795, in _queue_task_done
    future.result()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/events.py", line 708, in _run_handlers_sequential
    handler.callback(queue=queue, **merged_kwargs)
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/mode_controller.py", line 107, in initialize_modes
    mode.initialize_mode()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/core/mode.py", line 555, in initialize_mode
    self.mode_init()
  File "/nix/store/3q3jfx3hwv9fj185hffcpdrvz3vivyxb-python3-3.11.9-env/lib/python3.11/site-packages/mpf/modes/carousel/code/carousel.py", line 46, in mode_init
    raise AssertionError("Specify at least one item to select from")
AssertionError: Specify at least one item to select from
10:54:15.603 : INFO [root] MPF run loop ended.
solomon-b commented 3 months ago

Switching to commit b9fa1d40248097bb5f31a79b8fe7c4ec16b2ea60 fixed the issue. Should I not use the 0.80.x branch?

avanwinkle commented 3 months ago

Oh, you found a bug!

I recently reworked the Attract mode to inherit from Carousel, since pretty much everybody uses a carousel in their attract mode and it's silly to have to spin up two (because Attract mode also has custom code, so you can't just use a Carousel).

Unfortunately I forgot to handle the situation where an attract mode does not have carousel properties defined, which caused the Carousel code to throw.

I've added some conditional checks to the Attract code that skips the Carousel setup if no carousel is described in the mode_settings: configuration, and validated that attract mode now boots up and runs as expected.

My apologies for the error, I try and keep the 0.80.x branch stable but sometimes things slip through.

solomon-b commented 3 months ago

Right on, I'm happy to have been of help.