simon-weber / gmusicapi

An unofficial client library for Google Music.

Home Page:https://unofficial-google-music-api.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeEncodeError on Mobileclient.search()

gcfrxbots opened this issue · comments

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 characters in position 263997-264004: character maps to <undefined>
Call stack:
  File "C:/Users/Grant/IdeaProjects/rxbot3/Run.py", line 4, in <module>
    from SongRequest import *
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Grant\IdeaProjects\rxbot3\SongRequest.py", line 30, in <module>
    print(api.search("test"))
  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))

is being thrown every time I try any sort of search after moving my script over from py2 to py3.7.
I've tried pretty much everything and no matter what I try to encode anything as I still get the same issue.

This is the code for logging in and running the search:

api = Mobileclient()
api.__init__(debug_logging=True, validate=True, verify_ssl=True)
api.oauth_login(device_id=Mobileclient.FROM_MAC_ADDRESS, oauth_credentials="oauth.txt")
if api.is_authenticated():
    print("Logged into GPM successfully")
else:
    sendMessage(s, "Can't log into Google Play Music! Please check the console and follow the instructions!")
    api.perform_oauth(storage_filepath="oauth.txt")
    api.oauth_login(device_id=Mobileclient.FROM_MAC_ADDRESS, oauth_credentials="oauth.txt")

stream_url = ""

print(api.search("test"))
quit()``` 

I'm copying this directly from the docs and it's still not working, I can't find anything anywhere online about the issue either

This looks like a duplicate of #632.