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

absubmit and unicode characters in analysis file causes crash #2673

Closed
arogl opened this issue Aug 27, 2017 · 3 comments
Closed

absubmit and unicode characters in analysis file causes crash #2673

arogl opened this issue Aug 27, 2017 · 3 comments
Labels
bug bugs that are confirmed and actionable

Comments

@arogl
Copy link
Contributor

arogl commented Aug 27, 2017

Problem

When the output file from streaming_extractor_music.exe on windows has a Unicode character in the analysis the json parser crashes

This could be an issue with the streaming_extractor_music.exe handling unicode in Windows.

Would be nice to catch this rather than crashing.
I have added a print statement to absubmit.py to help debug

Running this command in verbose (-vv) mode:

> beet -vv absubmit
user configuration: C:\Users\arogl\AppData\Roaming\beets\config.yaml
data directory: C:\Users\arogl\AppData\Roaming\beets
plugin paths: C:\Users\arogl\AppData\Roaming\beets\beetsplug
Sending event: pluginload
library database: C:\Users\arogl\AppData\Roaming\beets\library.db
library directory: I:\Music
Sending event: library_opened
absubmit: Analysing 10cc - 70's Dinner Party - The Things We Do for Love,
absubmit: Successfully submitted AcousticBrainz analysis for 10cc - 70's Dinner Party - The Things We Do for Love.
absubmit: Analysing 10cc - AM Gold: 1975 - I'm Not in Love,

Led to this problem:

Traceback (most recent call last):
  File "C:\Python36\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.4.6', 'console_scripts', 'beet')()
  File "C:\Python36\lib\site-packages\beets-1.4.6-py3.6.egg\beets\ui\__init__.py", line 1256, in main
    _raw_main(args)
  File "C:\Python36\lib\site-packages\beets-1.4.6-py3.6.egg\beets\ui\__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Python36\lib\site-packages\beets-1.4.6-py3.6.egg\beetsplug\absubmit.py", line 108, in command
    analysis = self._get_analysis(item)
  File "C:\Python36\lib\site-packages\beets-1.4.6-py3.6.egg\beetsplug\absubmit.py", line 138, in _get_analysis
    analysis = json.loads(tmp_file.read())
  File "C:\Python36\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 49639: character maps to <undefined>

Setup

  • OS: win10 x64
  • Python version: 3.6.2 x64
  • beets version: git latest
  • Turning off plugins made problem go away (yes/no): yes, absubmit plugin no longer works
        "label": ["EMI�Capitol Music Special Markets"],
 the characters become \uE2\u20AC

	    "label":["EMI‐Capitol Music Special Markets"]

	    the ‐ is \u2010

@sampsyo sampsyo added the bug bugs that are confirmed and actionable label Aug 27, 2017
@sampsyo
Copy link
Member

sampsyo commented Aug 27, 2017

Thanks again for the thorough report! This was again a pretty easy fix (I think). Can you please check whether the above commit did the trick?

@arogl
Copy link
Contributor Author

arogl commented Aug 28, 2017

This has successfully continued past where it failed. So I'll say it is working.

@sampsyo
Copy link
Member

sampsyo commented Aug 28, 2017

Great news!

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