Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

UnicodeEncodeError with logging when using Mobileclient Search #667

Open
gcfrxbots opened this issue May 29, 2020 · 1 comment
Open

UnicodeEncodeError with logging when using Mobileclient Search #667

gcfrxbots opened this issue May 29, 2020 · 1 comment

Comments

@gcfrxbots
Copy link

New error popping up:

--- Logging error ---
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\logging\__init__.py", line 985, in emit
    stream.write(msg)
  File "C:\Program Files\Python37\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f49b' in position 32828: character maps to <undefined>

Call Stack:
  File "C:\Program Files\Python37\lib\site-packages\gmusicapi\clients\mobileclient.py", line 1961, in search
    res = self._make_call(mobileclient.Search, query, max_results)
  File "C:\Program Files\Python37\lib\site-packages\gmusicapi\clients\mobileclient.py", line 48, in _make_call
    return super(Mobileclient, self)._make_call(protocol, *args, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\gmusicapi\clients\shared.py", line 90, in _make_call
    return protocol.perform(self.session, self.validate, *args, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\gmusicapi\protocol\shared.py", line 247, in perform
    log.debug(cls.filter_response(parsed_response))

Happens when calling mobileclient.search("test") and the encoding used for the string doesnt seem to affect it.

@simon-weber
Copy link
Owner

Hm, this sounds like #632 (comment) again, though I had thought it was fixed. I guess this is during printing to the console rather than the file?

I don't think there's a straightforward way to override the system encoding in this case. The workarounds look pretty hacky:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants