Monitor in .57

36 views
Skip to first unread message

Ben Tripoli

unread,
Nov 2, 2024, 3:17:36 AMNov 2
to MPF Users
After running .57 on my production machine, its so much slicker than .56. I wanted to upgrade my development PC but running into the below with the monitor. Not much of a python coder and I tried a few things to fix this in the mpfmon.py file but to no avail. Is this a bug or my pc?

Thanks in advance for any help with this one.

INFO : root : Loading MPF Monitor
ERROR : root :
"safe_load()" has been removed, use

  yaml = YAML(typ='safe', pure=True)
  yaml.load(...)

instead of file "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/core/mpfmon.py", line 245

                self.config = yaml.safe_load(f)

Traceback (most recent call last):
  File "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/commands/monitor.py", line 107, in __init__
    run(machine_path=machine_path, thread_stopper=thread_stopper, config_file=args.configfile)
  File "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/core/mpfmon.py", line 305, in run
    MPFMonitor(app, machine_path, thread_stopper, config_file, testing=testing)
  File "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/core/mpfmon.py", line 52, in __init__
    self.load_config()
  File "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/core/mpfmon.py", line 245, in load_config
    self.config = yaml.safe_load(f)
  File "/home/ed/.local/lib/python3.8/site-packages/ruamel/yaml/main.py", line 1105, in safe_load
    error_deprecation('safe_load', 'load', arg="typ='safe', pure=True")
  File "/home/ed/.local/lib/python3.8/site-packages/ruamel/yaml/main.py", line 1037, in error_deprecation
    raise AttributeError(s)
AttributeError:
"safe_load()" has been removed, use

  yaml = YAML(typ='safe', pure=True)
  yaml.load(...)

instead of file "/home/ed/.local/lib/python3.8/site-packages/mpfmonitor/core/mpfmon.py", line 245

                self.config = yaml.safe_load(f)


INFO : root : Stopping child threads... (0 remaining)
INFO : root : All child threads stopped.

Alex L

unread,
Nov 2, 2024, 5:43:10 AMNov 2
to MPF Users

I ran into this same problem a few months back! It turns out the yaml library used by monitor changed how it wants to be called, but monitor versions up through 0.57.0 use the older syntax. 


The fix for you should be pretty quick, you just need to upgrade monitor to version 0.57.1 (which is also the latest and works with mpf 0.80.x as well). 

Ben Tripoli

unread,
Nov 2, 2024, 8:10:52 AMNov 2
to MPF Users
Oh I see. The old version wasnt uninstalled so it was running trying to run the old, even though I thought I had the new monitor installed.

Thanks for that. All good now.
Reply all
Reply to author
Forward
0 new messages