Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ZeroDivisionError: division by zero (osu learning)

I cant fix that error

---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
Cell In[17], line 1
----> 1 data_files = osulearn.dataset.all_files(OSU_FOLDER, verbose=True)
      3 if not os.path.exists('.data'):
      4     os.makedirs('.data')

File c:\Users\danil\OneDrive\Desktop\OsuLearn-master\OsuLearn-master\osulearn\dataset.py:41, in all_files(osu_path, limit, verbose)
     39 for i in range(len(replays)-1, -1, -1):
     40     if verbose:
---> 41         _print_progress_bar(replays, i, reverse=True)
     43     beatmap = _get_replay_beatmap_file(osu_path, replays[i])
     45     if beatmap is None:

File c:\Users\danil\OneDrive\Desktop\OsuLearn-master\OsuLearn-master\osulearn\_cli.py:4, in _print_progress_bar(collection, index, bar_width, buffer_width, reverse)
      1 def _print_progress_bar(collection, index, bar_width=40, buffer_width=80, reverse=False):
      2     bar_format = "\r[{done}>{todo}] {text}"
----> 4     progress = index / (len(collection) - 1)
      5     if reverse:
      6         progress = 1 - progress

ZeroDivisionError: division by zero

I dont know how to fix it, i tried to find in google but nothing found

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It seems that the expression

progress = index / (len(collection) - 1)

directly part this part len(collection) - 1 in case that collection has size 1, it generates ZeroDivisionError.

You have to increate sice of collection (> one item) and all will be correct.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading