Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle "float division by zero" more gracefully #621

Open
hadess opened this issue May 6, 2024 · 3 comments
Open

Handle "float division by zero" more gracefully #621

hadess opened this issue May 6, 2024 · 3 comments

Comments

@hadess
Copy link

hadess commented May 6, 2024

Trying to rip https://musicbrainz.org/release/9b7c8b00-0e37-4a0d-8fc1-3d0caa2c00c8 using one of my more reliable CD drives (a Samsung-branded USB DVD drive, TSSTcorp CDDVDW SE-208DB (MF00)), I got:

INFO:whipper.command.cd:using configured read offset 6
INFO:whipper.command.cd:checking device /dev/sr1
CDDB disc id: 02119e11
MusicBrainz disc id LGQXTzPqQ0PM04GzpYK553mQcP8-
MusicBrainz lookup URL https://musicbrainz.org/cdtoc/attach?toc=1+17+338429+150+19127+32902+43905+65508+81139+83375+109349+130786+147105+167660+198364+220295+248945+269620+296580+314878&tracks=17&id=LGQXTzPqQ0PM04GzpYK553mQcP8-
Disc duration: 01:15:10.386, 17 audio tracks

Matching releases:

Artist  : Bob Sinclar
Title   : Enjoy: The Movie & The Mix (Disc 1 of 2)
Duration: 01:15:10.379
URL     : https://musicbrainz.org/release/9b7c8b00-0e37-4a0d-8fc1-3d0caa2c00c8
Release : 9b7c8b00-0e37-4a0d-8fc1-3d0caa2c00c8
Type    : Compilation
Barcode : 826194003326
Country : United Kingdom
Cat no  : ENJOY01CD

INFO:whipper.command.cd:ripping track 1 of 17: 01. Bob Sinclar - Save our Soul.flac
WARNING:whipper.program.cdparanoia:file size 0 did not match expected size 44633948
WARNING:whipper.program.cdparanoia:non-integral amount of frames difference
Traceback (most recent call last): 100 %
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 193, in getTrackQuality
    return min(frames * 2.0 / reads, 1.0)
               ~~~~~~~~~~~~~^~~~~~~
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 324, in _read
    self._done()
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 400, in _done
    self.quality = self._parser.getTrackQuality()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 195, in getTrackQuality
    raise RuntimeError("cdparanoia couldn't read any frames "
RuntimeError: cdparanoia couldn't read any frames for the current track
INFO:whipper.command.cd:ripping track 1 of 17 (try 2): 01. Bob Sinclar - Save our Soul.flac
WARNING:whipper.program.cdparanoia:file size 0 did not match expected size 44633948
WARNING:whipper.program.cdparanoia:non-integral amount of frames difference
Traceback (most recent call last):f 9) ... 100 %
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 193, in getTrackQuality
    return min(frames * 2.0 / reads, 1.0)
               ~~~~~~~~~~~~~^~~~~~~
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 324, in _read
    self._done()
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 400, in _done
    self.quality = self._parser.getTrackQuality()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 195, in getTrackQuality
    raise RuntimeError("cdparanoia couldn't read any frames "
RuntimeError: cdparanoia couldn't read any frames for the current track
INFO:whipper.command.cd:ripping track 1 of 17 (try 3): 01. Bob Sinclar - Save our Soul.flac
WARNING:whipper.program.cdparanoia:file size 0 did not match expected size 44633948
WARNING:whipper.program.cdparanoia:non-integral amount of frames difference
Traceback (most recent call last):f 9) ... 100 %
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 193, in getTrackQuality
    return min(frames * 2.0 / reads, 1.0)
               ~~~~~~~~~~~~~^~~~~~~
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 324, in _read
    self._done()
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 400, in _done
    self.quality = self._parser.getTrackQuality()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 195, in getTrackQuality
    raise RuntimeError("cdparanoia couldn't read any frames "
RuntimeError: cdparanoia couldn't read any frames for the current track
INFO:whipper.command.cd:ripping track 1 of 17 (try 4): 01. Bob Sinclar - Save our Soul.flac
WARNING:whipper.program.cdparanoia:file size 0 did not match expected size 44633948
WARNING:whipper.program.cdparanoia:non-integral amount of frames difference
Traceback (most recent call last):f 9) ... 100 %
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 193, in getTrackQuality
    return min(frames * 2.0 / reads, 1.0)
               ~~~~~~~~~~~~~^~~~~~~
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 324, in _read
    self._done()
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 400, in _done
    self.quality = self._parser.getTrackQuality()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 195, in getTrackQuality
    raise RuntimeError("cdparanoia couldn't read any frames "
RuntimeError: cdparanoia couldn't read any frames for the current track
INFO:whipper.command.cd:ripping track 1 of 17 (try 5): 01. Bob Sinclar - Save our Soul.flac
WARNING:whipper.program.cdparanoia:file size 0 did not match expected size 44633948
WARNING:whipper.program.cdparanoia:non-integral amount of frames difference
Traceback (most recent call last):f 9) ... 100 %
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 193, in getTrackQuality
    return min(frames * 2.0 / reads, 1.0)
               ~~~~~~~~~~~~~^~~~~~~
ZeroDivisionError: float division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 324, in _read
    self._done()
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 400, in _done
    self.quality = self._parser.getTrackQuality()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/whipper/program/cdparanoia.py", line 195, in getTrackQuality
    raise RuntimeError("cdparanoia couldn't read any frames "
RuntimeError: cdparanoia couldn't read any frames for the current track
CRITICAL:whipper.command.cd:giving up on track 1 after 5 times

The division by zero should probably be caught.

Using whipper-0.10.0-11.fc39.x86_64, issue is similar to #202

@migrgh
Copy link

migrgh commented May 9, 2024

@MerlijnWajer
Copy link
Collaborator

I don't think this issue is related to the issue above, I believe this can happen for example if cdparanoia cannot rip a track. I think the request is to show a more sensible error, but I am not quite sure what it should be.

@hadess
Copy link
Author

hadess commented May 10, 2024

I don't think this issue is related to the issue above,

It's not that libcdio bug, all the other discs can be ripped. This drive didn't like the disc, I tested it in another drive and it worked fine.

I believe this can happen for example if cdparanoia cannot rip a track. I think the request is to show a more sensible error, but I am not quite sure what it should be.

I think that the "cdparanoia couldn't read any frames for the current track" and "giving up..." messages are fine, we just need to get rid of the Python traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants