Closed doronbehar closed 4 years ago
Thanks! This does look like a problem. However, it looks like it's not directly tied to missing the lyrics for a specific album; instead, this crash is happening at the end of the process, after emitting all the lyrics for the matched set of items.
That call to self.writerest(opts.writerest, None)
happens after printing out all the lyrics. There, the item
parameter is clearly None
. Then, we have this relevant stanza from the writerest
method:
if item is None or slug(self.artist) != slug(item.artist):
if self.rest is not None:
path = os.path.join(directory, 'artists',
slug(self.artist) + u'.rst')
with open(path, 'wb') as output:
output.write(self.rest.encode('utf-8'))
self.rest = None
if item is None:
return
self.artist = item.artist.strip()
Saliently, the final line tries to access item.art
even when item is None
is true—if self.rest is not None
.
@anarcat, can you please take a look?
following, I have the same issue
Note you can use the "subscribe" button at the side bar (desktop) or at the bottom of the page (mobile) instead of commenting and thus notifying everyone else subscribed :)
is there any workaround for this?
Is there a fix for this yet?
I have got a similar error:
beet lyrics empress rising lyrics: fetched lyrics: Monolord - Empress Rising - Empress Rising Traceback (most recent call last): File "/usr/bin/beet", line 11, in
load_entry_point('beets==1.4.9', 'console_scripts', 'beet')() File "/usr/lib/python3.8/site-packages/beets/ui/init.py", line 1266, in main _raw_main(args) File "/usr/lib/python3.8/site-packages/beets/ui/init.py", line 1253, in _raw_main subcommand.func(lib, suboptions, subargs) File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 745, in func self.fetch_item_lyrics( File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 840, in fetch_item_lyrics lyrics = [self.get_lyrics(artist, title) for title in titles] File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 840, in lyrics = [self.get_lyrics(artist, title) for title in titles] File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 873, in get_lyrics lyrics = backend.fetch(artist, title) File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 403, in fetch return self.lyrics_from_song_api_path(song_api_path) File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 375, in lyrics_from_song_apipath lyrics = html.find("div", class="lyrics").get_text() AttributeError: 'NoneType' object has no attribute 'get_text'
After disabling 'genius' in the sources list in config.yaml lyrics runs through without any error. So I guess in my case it has something to do with 'genius'.
+1 same error as @jimbo27
Quick fix in the code just to prevent the error, which does not fix the problem with Genius:
File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 375
if lyrics is None:
lyrics = ""
else:
lyrics = lyrics.get_text()
+1 same error as @jimbo27. Applying the quick fix from @Linkandzelda worked for me.
Hi! Would any of you be willing to open a pull request with this fix? Thanks!!
I would suggest investigating it further since all the fix does is return an empty string and only targets @jimbo27 and my error. If there is an underlying problem with Genius lyrics and lyrics is always None, it will always return an empty string.
Just a quick comment to say that in the end I've built my own python tool JUST to scrape lyrics, inspired from this beets module.
Supported is Genius, MusixMatch, LyricsWorld, FlashLyrics, LyricsFreak, Decoda, SongLyrics, Lyrics24 and MetroLyrics
also added support for automatically redirect certain titles (ie, when searching for "DAFT PUNK VS MODJO - One More Lady - DJ Stein Mix" , search for "MODJO - Lady" instead
https://github.com/pestrela/music/blob/master/traktor/tools_traktor/cue_scrape_lyrics.py
I would suggest investigating it further since all the fix does is return an empty string and only targets @jimbo27 and my error. If there is an underlying problem with Genius lyrics and lyrics is always None, it will always return an empty string.
@sampsyo I can look into this
Quick fix in the code just to prevent the error, which does not fix the problem with Genius:
File "/usr/lib/python3.8/site-packages/beetsplug/lyrics.py", line 375
if lyrics is None: lyrics = "" else: lyrics = lyrics.get_text()
The Genius issue was already fixed in https://github.com/beetbox/beets/pull/3554, can't replicate it anymore.
Fixed by @ybnd in #3612. :smiley:
EDIT: Nevermind I don't think I trust tekstowo for lyrics anyway
Problem
I search manually for lyrics of a specific track and It exits with the following traceback:
Setup
3.6.4
1.4.6
My configuration (output of
beet config
) is: