pylast get_top_tags not working for artist and song pulled from csv file

171 Views Asked by At

So I have a csv file with a bunch of artists and associated song names. I parse this file and set the artist and song name equal to variables. Then I use the artist and song name to get the track through pylast and it works fine. I print the track and it exists. But then when I do tags = track.get_top_tags(limit=None) I get pylast.WSError: Track not found. I've tried passing in just straight strings of the song title and artist to get_top_tags and it works fine so I don't understand. I've tried messing with the encodings but nothing is fixing it. This is my code..

with open(music_library_filename,'r',encoding='iso-8859-1') as music_library_csv:
csv_reader = csv.reader(music_library_csv,delimiter=',')
for row in csv_reader:
    song_name=str(row[0])
    artist=str(row[1])
    album=row[2]
    added_date=row[3]
    try:
        track = network.get_track(artist, song_name)
        print(track)
        tags = track.get_top_tags(limit=None)
    except:
        print("Track " + song_name + " not found")
        continue;

Here's my full traceback..

Traceback (most recent call last):
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/music_analysis.py", line 29, in <module>
    tags = track.get_top_tags(limit=None)
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/pylast/__init__.py", line 1282, in get_top_tags
    doc = self._request(self.ws_prefix + '.getTopTags', True)
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/pylast/__init__.py", line 1031, in _request
    return _Request(self.network, method_name, params).execute(cacheable)
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/pylast/__init__.py", line 870, in execute
    response = self._download_response()
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/pylast/__init__.py", line 860, in _download_response
    self._check_response_for_errors(response_text)
  File "/Users/kcingel/PycharmProjects/my_music_library_analysis/pylast/__init__.py", line 890, in _check_response_for_errors
    raise WSError(self.network, status, details)
pylast.WSError: Track not found
0

There are 0 best solutions below