moehmeni/syncedlyrics

UnboundLocalError: local variable 'lrc' referenced before assignment

qwertyadrian opened this issue · 3 comments

I get the following error

Traceback (most recent call last):
  File "/home/qwertyadrian/PycharmProjects/pyscripts/lyrics_test.py", line 4, in <module>
    lrc =  provider.get_lrc('Bâtard - Stromae')
  File "/home/qwertyadrian/PycharmProjects/pyscripts/venv/lib/python3.10/site-packages/syncedlyrics/providers/deezer.py", line 46, in get_lrc
    return self.get_lrc_by_id(song["id"])
  File "/home/qwertyadrian/PycharmProjects/pyscripts/venv/lib/python3.10/site-packages/syncedlyrics/providers/deezer.py", line 38, in get_lrc_by_id
    lrc += f"{chunk['lrc_timestamp']} {chunk['line']}\n"
UnboundLocalError: local variable 'lrc' referenced before assignment

when running this code (for example):

from syncedlyrics.providers import Deezer

provider = Deezer()
lrc =  provider.get_lrc('Bâtard - Stromae')

In the class method syncedlyrics.providers.Deezer.get_lrc_by_id variable lrc is not defined.

Thanks for the issue, it should be solved now.

Not related to this issue but now it seems Deezer API no longer works, I added another provider which is rich and contains this song too. New in v0.3.0

Thanks for the update.