nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
532 stars 58 forks source link

'utf-8' codec can't decode byte 0xff in position 0: invalid start byte #554

Open Mte90 opened 2 years ago

Mte90 commented 2 years ago

Ticket migrated from https://github.com/nicfit/MishMash/issues/810 that is of this library

ERROR:mishmash:'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/mishmash/__main__.py", line 55, in main
    retval = args.command_func(args) or 0
  File "/usr/local/lib/python3.9/dist-packages/mishmash/core.py", line 37, in run
    retval = super().run(args)
  File "/usr/local/lib/python3.9/dist-packages/nicfit/command.py", line 93, in run
    return self._run()
  File "/usr/local/lib/python3.9/dist-packages/mishmash/commands/sync/sync.py", line 504, in _run
    result = _syncLib(lib)
  File "/usr/local/lib/python3.9/dist-packages/mishmash/commands/sync/sync.py", line 497, in _syncLib
    return eyed3_main(args, None)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/main.py", line 41, in main
    eyed3.utils.walk(args.plugin, p, excludes=args.excludes, fs_encoding=args.fs_encoding,
  File "/usr/local/lib/python3.9/dist-packages/eyed3/utils/__init__.py", line 88, in walk
    handler.handleFile(f)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/plugins/__init__.py", line 172, in handleFile
    self.audio_file = core.load(f, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/core.py", line 442, in load
    return mp3.Mp3AudioFile(path, tag_version)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/mp3/__init__.py", line 145, in __init__
    super().__init__(path)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/core.py", line 231, in __init__
    self._read()
  File "/usr/local/lib/python3.9/dist-packages/eyed3/mp3/__init__.py", line 151, in _read
    tag_found = self._tag.parse(file_obj, self._tag_version)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/tag.py", line 99, in parse
    tag_found, padding = self._loadV2Tag(fileobj)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/tag.py", line 131, in _loadV2Tag
    padding = self.frame_set.parse(fp, self.header,
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1788, in parse
    frame = createFrame(tag_header, frame_header, data)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1888, in createFrame
    frame.parse(data, frame_header)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 611, in parse
    self.description = decodeUnicode(desc, encoding)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1904, in decodeUnicode
    return str(bites, codec).rstrip("\x00")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
General error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/mishmash/__main__.py", line 55, in main
    retval = args.command_func(args) or 0
  File "/usr/local/lib/python3.9/dist-packages/mishmash/core.py", line 37, in run
    retval = super().run(args)
  File "/usr/local/lib/python3.9/dist-packages/nicfit/command.py", line 93, in run
    return self._run()
  File "/usr/local/lib/python3.9/dist-packages/mishmash/commands/sync/sync.py", line 504, in _run
    result = _syncLib(lib)
  File "/usr/local/lib/python3.9/dist-packages/mishmash/commands/sync/sync.py", line 497, in _syncLib
    return eyed3_main(args, None)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/main.py", line 41, in main
    eyed3.utils.walk(args.plugin, p, excludes=args.excludes, fs_encoding=args.fs_encoding,
  File "/usr/local/lib/python3.9/dist-packages/eyed3/utils/__init__.py", line 88, in walk
    handler.handleFile(f)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/plugins/__init__.py", line 172, in handleFile
    self.audio_file = core.load(f, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/core.py", line 442, in load
    return mp3.Mp3AudioFile(path, tag_version)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/mp3/__init__.py", line 145, in __init__
    super().__init__(path)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/core.py", line 231, in __init__
    self._read()
  File "/usr/local/lib/python3.9/dist-packages/eyed3/mp3/__init__.py", line 151, in _read
    tag_found = self._tag.parse(file_obj, self._tag_version)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/tag.py", line 99, in parse
    tag_found, padding = self._loadV2Tag(fileobj)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/tag.py", line 131, in _loadV2Tag
    padding = self.frame_set.parse(fp, self.header,
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1788, in parse
    frame = createFrame(tag_header, frame_header, data)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1888, in createFrame
    frame.parse(data, frame_header)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 611, in parse
    self.description = decodeUnicode(desc, encoding)
  File "/usr/local/lib/python3.9/dist-packages/eyed3/id3/frames.py", line 1904, in decodeUnicode
    return str(bites, codec).rstrip("\x00")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
coofercat commented 2 years ago

I have no idea if this is you problem or not, but this looks like the file wasn't opened in binary mode (ie. it was opened with "r" instead of "rb").

Mte90 commented 2 years ago

I was facing this issue (I am not using this tool since months) so I have no idea...

hardfau1t commented 2 years ago

I faced same problem, it seems like it is specific to some Files, converted the file to wav and converted back to mp3 resolved this issue