Skip to content

Error if the Bookmarks field is present but empty #117

Open
@120-cell

Description

Some beatmap files contain a line for Bookmarks without any values like this:

[Editor]
Bookmarks:

Presumably they have been manually edited, since the editor will not generate a line for bookmarks if there are none. Here's the map where I found the issue:
Sasaki Sayaka - Golden Mission (yuzu__rinrin) [Futsuu].osu.txt

The game will still accept such files, but the parser throws an error:

Exception has occurred: ValueError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
field 'Bookmarks' in section 'Editor' should be an int list, got ''
  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 1115, in _get_as_int_list
    return [int(e.strip()) for e in v.split(',')]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 1115, in <listcomp>
    return [int(e.strip()) for e in v.split(',')]
            ^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 1117, in _get_as_int_list
    raise ValueError(
  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 2600, in parse
    timedelta(milliseconds=ms) for ms in _get_as_int_list(
                                         ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 2398, in from_file
    return cls.parse(file.read())
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/slider/beatmap.py", line 2349, in from_path
    return cls.from_file(file)
           ^^^^^^^^^^^^^^^^^^^
ValueError: field 'Bookmarks' in section 'Editor' should be an int list, got ''

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions