Issue #23 duplicate

unicode TypeError adding image with APIC description

Oliver Joos
created an issue

I use eyeD3 0.7.1 in Mint 14.1 (with pip install). If I do:

eyeD3 --add-image './image.jpg:FRONT_COVER:my-image-desc' test.mp3

...then I get the Traceback below. I attached a quick&dirty fix here that solves it at least in my environment.

eyed3.plugins.classic:ERROR: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eyed3/plugins/classic.py", line 401, in handleFile
    save_tag = (self.handleEdits(self.audio_file.tag) or
  File "/usr/local/lib/python2.7/dist-packages/eyed3/plugins/classic.py", line 835, in handleEdits
    tag.images.set(img_type, img_fp.read(), img_mt, img_desc)
  File "/usr/local/lib/python2.7/dist-packages/eyed3/utils/__init__.py", line 155, in wrapped_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/eyed3/id3/tag.py", line 1205, in set
    picture_type=type)
  File "/usr/local/lib/python2.7/dist-packages/eyed3/utils/__init__.py", line 154, in wrapped_fn
    (fn.__name__, name))
TypeError: __init__(argument description) must be unicode

Additional note

A clean solution could also take care of the fact that players and tools exists (Symbian S60 phones, MP3 Diags, ...) that ignore APIC images if their description text is not ascii or latin1 (not encoding id $00). So something like this would help:

try:
    img_desc.encode('latin_1')
except UnicodeError:
    img_desc.encode('utf_16')

Comments (1)

  1. Log in to comment