beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.92k stars 1.82k forks source link

Unicode path error in chroma plugin #200

Closed arogl closed 11 years ago

arogl commented 11 years ago

Similar error to https://github.com/sampsyo/beets/issues/106

D:\beets-master>beet -v import -c "h:\New_Music\(1992) Our Time in Eden"
data directory: C:\Users\Andrew\AppData\Roaming\beets
library database: C:\Users\Andrew\AppData\Roaming\beets\library.db
library directory: H:\Sorted_Music
Sending event: import_task_start
Traceback (most recent call last):
  File "C:\Python27\Scripts\beet-script.py", line 8, in <module>
    load_entry_point('beets==1.1.0-beta.3', 'console_scripts', 'beet')()
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\ui\__init__.py", line 771, in main
    _raw_main(args)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\ui\__init__.py", line 763, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\ui\commands.py", line 735, in import_func
    import_files(lib, paths, query)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\ui\commands.py", line 673, in import_files
    session.run()
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\importer.py", line 339, in run
    pl.run_sequential()
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\util\pipeline.py", line 330, in run_sequential
    out = coro.send(msg)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\importer.py", line 642, in initial_lookup
    plugins.send('import_task_start', session=session, task=task)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beets\plugins.py", line 315, in send
    handler(**arguments)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beetsplug\chroma.py", line 172, in fingerprint_task
    acoustid_match(item.path)
  File "C:\Python27\lib\site-packages\beets-1.1.0_beta.3-py2.7.egg\beetsplug\chroma.py", line 54, in acoustid_match
    duration, fp = acoustid.fingerprint_file(util.syspath(path))
  File "C:\Python27\lib\site-packages\acoustid.py", line 304, in fingerprint_file
    return _fingerprint_file_fpcalc(path)
  File "C:\Python27\lib\site-packages\acoustid.py", line 264, in _fingerprint_file_fpcalc
    proc = subprocess.Popen(command, stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
  startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 126: ordinal not in range(128)

Command run previous to

beet remove Our Time in Eden

Any ideas?

sampsyo commented 11 years ago

Thanks again for the report. This is due to a bug in Python 2 on Windows. We use a workaround for this in the replaygain plugin, so I'm going to add that workaround here. It will cause beets to just skip over files like this—unfortunately, there's no way to successfully fingerprint them using subprocess invocation.

This fix will be applied in the pyacoustid module, not here in beets, so I'm closing this issue now.