xgate1 / pylast

Automatically exported from code.google.com/p/pylast
Apache License 2.0
0 stars 0 forks source link

Some characters causing trouble in get_top_tags() #48

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
#!/usr/bin/env python
import pylast
import os

API_KEY = ""
API_SECRET = ""
u_name = ""
p_hash = pylast.md5("")
lastfm = pylast.get_lastfm_network(api_key = API_KEY, api_secret = API_SECRET, 
username = u_name, password_hash = p_hash)
Artists = os.listdir(".")
Artists.sort()
for ArtistName in Artists:
    print ArtistName
    Artist = lastfm.get_artist(ArtistName)
    TopTags = Artist.get_top_tags()

#
Revision: 226

Reproduce:
Create a folder and cd into it. Then make folder Mötorhead or Ljå
Run the program from the first dir you created.

Output:
~/test$ ls
Enslaved  Leaves' Eyes  Ljå  Lumsk  Mötorhead
~/test$ ~/bin/pytest.py
Enslaved
Leaves' Eyes
Ljå
Traceback (most recent call last):
  File "~/bin/pytest.py", line 17, in <module>
    TopTags = Artist.get_top_tags()
  File "/usr/lib/python2.6/pylast.py", line 1080, in get_top_tags
    doc = self._request(self.ws_prefix + '.getTopTags', True)
  File "/usr/lib/python2.6/pylast.py", line 967, in _request
    return _Request(self.network, method_name, params).execute(cacheable)
  File "/usr/lib/python2.6/pylast.py", line 719, in __init__
    self.sign_it()
  File "/usr/lib/python2.6/pylast.py", line 725, in sign_it
    self.params['api_sig'] = self._get_signature()
  File "/usr/lib/python2.6/pylast.py", line 738, in _get_signature
    string += self.params[name]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 47: 
ordinal not in range(128)

Original issue reported on code.google.com by nae...@gmail.com on 4 Oct 2010 at 8:21

GoogleCodeExporter commented 8 years ago
Sorry. Forgot to set unicode. Delete this please.

Original comment by nae...@gmail.com on 4 Oct 2010 at 8:51

GoogleCodeExporter commented 8 years ago

Original comment by amr.hassan on 5 Oct 2010 at 3:44