xgate1 / pylast

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

IndexError on doc.getElementsByTagName('lfm')[0] #76

Open GoogleCodeExporter opened 8 years ago

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

Mopidy tried registering a "now playing" event using pylast, but pylast failed, 
probably because of a misformed response from Last.fm. From Mopidy's debug log:

DEBUG    2012-03-07 13:28:00,874 [25171:PykkaActorThread-955] 
mopidy.frontends.mpd
  Response to [::ffff:127.0.0.1]:51729 from urn:uuid:017562d5-4b12-4d6d-888c-70a97324ac39: 
    file: spotify:track:29c2Hhj9rT1B6dUM4MvPQ7
    Time: 341
    Artist: Netsky
    Title: Storm Clouds
    Album: Netsky
    Date: 2010-01-01
    Track: 7
    Pos: 6
    Id: 209
    OK
DEBUG    2012-03-07 13:28:00,875 [25171:PykkaActorThread-955] 
mopidy.frontends.mpd
  Request from [::ffff:127.0.0.1]:51729 to urn:uuid:017562d5-4b12-4d6d-888c-70a97324ac39: idle
DEBUG    2012-03-07 13:28:01,336 [25171:PykkaActorThread-7] 
mopidy.frontends.lastfm
  Now playing track: Netsky - Storm Clouds
ERROR    2012-03-07 13:28:01,419 [25171:PykkaActorThread-7] pykka
  Unhandled exception in LastfmFrontend (urn:uuid:b42051c2-388a-44d6-bca1-214690a21c9d):
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/pykka/actor.py", line 166, in _run
    response = self._handle_receive(message)
  File "/usr/lib/pymodules/python2.7/pykka/actor.py", line 237, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/home/sjodal/dev/mopidy/mopidy/frontends/lastfm.py", line 73, in track_playback_started
    mbid=(track.musicbrainz_id or ''))
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 465, in update_now_playing
    _Request(self, "track.updateNowPlaying", params).execute()
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 828, in execute
    response = self._download_response()
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 819, in _download_response
    self._check_response_for_errors(response_text)
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 840, in _check_response_for_errors
    e = doc.getElementsByTagName('lfm')[0]
IndexError: list index out of range

It would be nice if pylast could handle errors like this without crashing.

I'm running pylast 0.5.11 on Python 2.7.2.

Original issue reported on code.google.com by stein.ma...@jodal.no on 7 Mar 2012 at 12:58

GoogleCodeExporter commented 8 years ago
Does this still happen? 

I couldn't reproduce it with my fork:
https://github.com/hugovk/pylast/issues/77

Original comment by hugovk@gmail.com on 17 Apr 2014 at 1:54

GoogleCodeExporter commented 8 years ago
i've got the same problem:

2015-06-30 20:03:10,644 ERROR [5486:ScrobblerFrontend-9] pykka: Unhandled 
exception in ScrobblerFrontend (urn:uuid:89247c09-8823-486c-9f9c-aaa564d77cf9):
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 200, in _actor_loop
    response = self._handle_receive(message)
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 294, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/usr/lib/python2.7/dist-packages/mopidy/core/listener.py", line 33, in on_event
    getattr(self, event)(**kwargs)
  File "/usr/share/mopidy/mopidy_scrobbler/frontend.py", line 78, in track_playback_ended
    mbid=(track.musicbrainz_id or ''))
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 486, in scrobble
    "track_number": track_number, "duration": duration, "stream_id": stream_id, "context": context, "mbid": mbid},))
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 520, in scrobble_many
    _Request(self, "track.scrobble", params).execute()
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 828, in execute
    response = self._download_response()
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 819, in _download_response
    self._check_response_for_errors(response_text)
  File "/usr/lib/python2.7/dist-packages/pylast.py", line 840, in _check_response_for_errors
    e = doc.getElementsByTagName('lfm')[0]
IndexError: list index out of range

Original comment by rotalia...@gmail.com on 30 Jun 2015 at 6:30

GoogleCodeExporter commented 8 years ago
Which version of pylast?

Does it happen with the latest version, 1.2.1?

Please can you give a minimal script example with just pylast if possible?

And please can you report it over at the new home of pylast at 
https://github.com/pylast/pylast/issues/77 ?

Thank you!

Original comment by hugovk@gmail.com on 30 Jun 2015 at 6:53