whipper-team / whipper

Python CD-DA ripper preferring accuracy over speed
GNU General Public License v3.0
1.11k stars 88 forks source link

CRITICAL:whipper.command.main:exception UnicodeDecodeError at <frozen codecs>:322: decode(): 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte #595

Open s1LenT0R opened 1 year ago

s1LenT0R commented 1 year ago

`sofachillax@nydus ~/rip $ whipper cd rip --unknown INFO:whipper.command.cd:using configured read offset 6 INFO:whipper.command.cd:checking device /dev/sr0 Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/whipper/extern/task/task.py", line 523, in c callable_task(*args, *kwargs) File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 115, in _read self._done() File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 153, in _done self.toc.parse() File "/usr/lib/python3.11/site-packages/whipper/image/toc.py", line 203, in parse content = f.readlines() ^^^^^^^^^^^^^ File "", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte CRITICAL:whipper.command.main:exception UnicodeDecodeError at :322: decode(): 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/whipper/extern/task/task.py", line 523, in c callable_task(args, **kwargs) File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 115, in _read self._done() File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 153, in _done self.toc.parse() File "/usr/lib/python3.11/site-packages/whipper/image/toc.py", line 203, in parse content = f.readlines() ^^^^^^^^^^^^^ File "", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte

`

Happens to me with the 2nd disc of an unknown 2 CD Set.

github-actions[bot] commented 1 year ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing instructions.

Prospero4121 commented 1 year ago

Following... I have very similar message from new install of Whipper in new install of Manjaro.

linuxarchlinux commented 1 year ago

I think there is another open issue about this but now I cannot find it! I'm not sure if this is a bug within whipper or cdrdao package but downgrading cdrdao resolves the problem for me on Arch Linux/Manjaro.

The current version of cdrdao 1.2.5-1 updated around February 2023 exhibits this issue, but downgrading to cdrdao to 1.2.4-2 from https://archive.archlinux.org/packages/c/cdrdao/ resolves the problem for me using sudo pacman -U cdrdao-1.2.4-2...zstd

letorbi commented 1 year ago

I was able to get rid of the error by explicitly opening the file in ISO-8859-1 mode:

--- /whipper/image/toc.py.orig  2023-07-05 13:30:24.068315757 +0200
+++ /whipper/image/toc.py   2023-07-05 12:25:46.632444064 +0200
@@ -199,7 +199,7 @@
         # the first track's INDEX 1 can only be gotten from the .toc
         # file once the first pregap is calculated; so we add INDEX 1
         # at the end of each parsed  TRACK record
-        with open(self._path) as f:
+        with open(self._path, encoding='ISO-8859-1') as f:
             content = f.readlines()
         for number, line in enumerate(content):
             line = line.rstrip()

My patch works fine so far, but I have not made an intensive check on possible side-effects.

rndmc12 commented 11 months ago

See https://github.com/whipper-team/whipper/issues/591#issuecomment-1632834438 It's likely the same issue.

the-confessor commented 11 months ago

I am encountering this too. cdrdao is 1.2.5.

downgrading to crddao 1.2.4-r2 works around it for me too.

$ whipper cd info
INFO:whipper.command.cd:checking device /dev/sr0
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 115, in _read
    self._done()
  File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 153, in _done
    self.toc.parse()
  File "/usr/lib/python3.11/site-packages/whipper/image/toc.py", line 203, in parse
    content = f.readlines()
              ^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 79: invalid start byte
CRITICAL:whipper.command.main:exception UnicodeDecodeError at <frozen codecs>:322: decode(): 'utf-8' codec can't decode byte 0x85 in position 79: invalid start byte
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/whipper/extern/task/task.py", line 523, in c
    callable_task(*args, **kwargs)
  File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 115, in _read
    self._done()
  File "/usr/lib/python3.11/site-packages/whipper/program/cdrdao.py", line 153, in _done
    self.toc.parse()
  File "/usr/lib/python3.11/site-packages/whipper/image/toc.py", line 203, in parse
    content = f.readlines()
              ^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 79: invalid start byte
dylandrush commented 11 months ago

I'll also just throw out there that:

with open(self._path, encoding="utf-8") as f:
    content = f.readlines()

seemed to work for me, however, despite the fact that file self._path (*.cdrdao.read-toc.whipper.task) had a valid toc that contained all song names and titles. The end files resulted in Unkown Artist - Unknown Track. However, I'm guessing that's probably because I had to run with --unknown flag: CRITICAL:whipper.command.cd:unable to retrieve disc metadata, --unknown argument not passed