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

Crash on UnicodeDecodeError: 'ascii' codec can't decode byte #1666

Closed
teo opened this issue Oct 29, 2015 · 4 comments
Closed

Crash on UnicodeDecodeError: 'ascii' codec can't decode byte #1666

teo opened this issue Oct 29, 2015 · 4 comments
Labels
bug bugs that are confirmed and actionable
Milestone

Comments

@teo
Copy link

teo commented Oct 29, 2015

The import operation seems to crash, I'm guessing it might have something to do with characters in SoundCheck metadata. The files in question are MP3.

This happens in 1.3.15 as well as in current master.

beet -vv import -A public/Disks/red2/Music
(...)
Traceback (most recent call last):
  File "/usr/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.16', 'console_scripts', 'beet')()
  File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1163, in main
    _raw_main(args)
  File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1153, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 860, in import_func
    import_files(lib, paths, query)
  File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 837, in import_files
    session.run()
  File "/usr/lib/python2.7/site-packages/beets/importer.py", line 318, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/lib/python2.7/site-packages/beets/util/pipeline.py", line 251, in run
    msg = self.coro.next()
  File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1191, in read_tasks
    for t in task_factory.tasks():
  File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1036, in tasks
    tasks = self._create(self.album(paths, dirs))
  File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1115, in album
    items = map(self.read_item, paths)
  File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1165, in read_item
    return library.Item.from_path(path)
  File "/usr/lib/python2.7/site-packages/beets/library.py", line 482, in from_path
    i.read(path)
  File "/usr/lib/python2.7/site-packages/beets/library.py", line 539, in read
    value = getattr(mediafile, key)
  File "/usr/lib/python2.7/site-packages/beets/mediafile.py", line 1079, in __get__
    out = style.get(mediafile.mgfile)
  File "/usr/lib/python2.7/site-packages/beets/mediafile.py", line 553, in get
    return _sc_decode(data)[self.index]
  File "/usr/lib/python2.7/site-packages/beets/mediafile.py", line 218, in _sc_decode
    soundcheck = soundcheck.replace(' ', '').decode('hex')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 93: ordinal not in range(128)
@sampsyo sampsyo added the bug bugs that are confirmed and actionable label Oct 29, 2015
@sampsyo
Copy link
Member

sampsyo commented Oct 29, 2015

Yep, this is a bug. Thanks for reporting! (Another unforeseen consequence of unicode_literals.)

So I can construct a test case, can you please provide a sample audio file that triggers the bug?

@sampsyo sampsyo added this to the 1.3.16 milestone Oct 29, 2015
@teo
Copy link
Author

teo commented Nov 3, 2015

I have the directory with the album that triggered the issue but I don't think it's legal to share here.

@sampsyo
Copy link
Member

sampsyo commented Nov 3, 2015

Yes, posting publicly wouldn't be a good idea. But perhaps you can email me privately? (My address is on the profile page.) To make the file useless for the music itself but still useful for the tags, you can truncate it to a few kilobytes.

@sampsyo
Copy link
Member

sampsyo commented Nov 13, 2015

Thank you for the sample data! Just committed a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

No branches or pull requests

2 participants