MiSTer_Favorites icon indicating copy to clipboard operation
MiSTer_Favorites copied to clipboard

Crashes loading existing favorite "can't decode byte 0xff"

Open cmcginty opened this issue 1 year ago • 1 comments

Having trouble processing strings attempting to load an existing favorite with rbf extension.

Traceback (most recent call last):
  File "/media/fat/Scripts/favorites.sh", line 1223, in <module>
    display_modify_item(selection)
  File "/media/fat/Scripts/favorites.sh", line 810, in display_modify_item
    setname = get_mgl_setname(path)
  File "/media/fat/Scripts/favorites.sh", line 402, in get_mgl_setname
    core = re.search("<setname>(.+)</setname>", f.read())
  File "/usr/lib/python3.9/codecs.py", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

The failures happen on all the RBF files. It looks there a bug that the script is reading the rbf file as a unicode string, but this is a binary file.

There is no error If I attempt to endit an mgl or mra based favorite.

My root favorites paths look like this:

/root# ls -l /media/fat/_\@Favorites/
total 480
drwxr-xr-x 9 root root 32768 Oct 30  2022  _Arcade
lrwxr-xr-x 1 root root    34 Aug 26 14:29 'Atari 2600.mgl' -> '/media/fat/_Console/Atari 2600.mgl'
lrwxr-xr-x 1 root root    42 Aug 26 14:29 'Atari 5200.rbf' -> /media/fat/_Console/Atari5200_20230227.rbf
lrwxr-xr-x 1 root root    42 Mar 25 20:00  Atari7800_20221227.rbf -> /media/fat/_Console/Atari7800_20221227.rbf
lrwxr-xr-x 1 root root    24 Oct 30  2022  cores -> /media/fat/_Arcade/cores
lrwxr-xr-x 1 root root    40 Mar 25 20:05  Genesis_20230224.rbf -> /media/fat/_Console/Genesis_20230224.rbf
drwxr-xr-x 2 root root 32768 Aug 11 18:41  _Handheld
lrwxr-xr-x 1 root root    39 Aug 11 18:41  MegaCD_20230716.rbf -> /media/fat/_Console/MegaCD_20230716.rbf
lrwxr-xr-x 1 root root    39 Aug 11 18:41  NeoGeo_20230803.rbf -> /media/fat/_Console/NeoGeo_20230803.rbf
lrwxr-xr-x 1 root root    36 Mar 25 20:02  NES_20230223.rbf -> /media/fat/_Console/NES_20230223.rbf
lrwxr-xr-x 1 root root    36 May 26 16:25  PSX_20230503.rbf -> /media/fat/_Console/PSX_20230503.rbf
lrwxr-xr-x 1 root root    37 May  1 21:21  S32X_20230501.rbf -> /media/fat/_Console/S32X_20230501.rbf
lrwxr-xr-x 1 root root    36 Mar 25 20:02  SMS_20230225.rbf -> /media/fat/_Console/SMS_20230225.rbf
lrwxr-xr-x 1 root root    37 Aug 11 18:41  SNES_20230803.rbf -> /media/fat/_Console/SNES_20230803.rbf
lrwxr-xr-x 1 root root    45 Aug 11 18:41  TurboGrafx16_20230627.rbf -> /media/fat/_Console/TurboGrafx16_20230627.rbf

cmcginty avatar Aug 26 '23 22:08 cmcginty

Thanks for reporting. I see what you mean! I'll try get a fix out soon

wizzomafizzo avatar Aug 27 '23 03:08 wizzomafizzo