adibaewa / pylast

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

non-ascii unicode breaks Album.get_imge_url() #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please type example code that produces the issue:

for alb in albums:
    url = alb.get_image_url()

What is the expected output? What do you see instead?

should get a url, but if name contains non ascii characters get unicode error:

  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 657, in
get_image_url
    return _extract_all(self._request("album.getInfo", cacheable = True),
'image')[size]
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 354, in
_request
    return _Request(method_name, params, *self.auth_data).execute(cacheable)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 152, in
__init__
    self.sign_it()
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 158, in sign_it
    self.params['api_sig'] = self._get_signature()
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 175, in
_get_signature
    return md5(string)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 2787, in md5
    hash.update(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in
position 12: ordinal not in range(128)

What version of pyLast is this?

0.3.4

Please provide any additional information below.

Original issue reported on code.google.com by timskinn...@gmail.com on 14 Jun 2009 at 2:33

GoogleCodeExporter commented 9 years ago
i think i fixed it now. give it a try.

Original comment by amr.hassan on 29 Jun 2009 at 10:48