syncedlyrics icon indicating copy to clipboard operation
syncedlyrics copied to clipboard

TypeError: list indices must be integers or slices, not str

Open igorgukasyan opened this issue 1 year ago • 0 comments

Hello,

While running a loop with syncedlyrics.search(), I sometimes face the following issue:

lrc = syncedlyrics.search("Synthetic Dream lextrical", allow_plain_format=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda3/lib/python3.11/site-packages/syncedlyrics/__init__.py", line 59, in search _l = provider.get_lrc(search_term) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/anaconda3/lib/python3.11/site-packages/syncedlyrics/providers/musixmatch.py", line 120, in get_lrc tracks = body["track_list"] ~~~~^^^^^^^^^^^^^^ TypeError: list indices must be integers or slices, not str

my code:

for index, row in combined_data.iterrows():
    song = row['combined'] 
    lyrics = syncedlyrics.search(song, allow_plain_format=True)  
    data.at[index, 'lyrics'] = lyrics

What partially helped me was time.sleep(180) after each error and retrying the same values before skipping, yet it does not always work.

igorgukasyan avatar May 12 '24 16:05 igorgukasyan