question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expected str instance nonetype found

See original GitHub issue

My code

from lyricsgenius import Genius

genius = Genius(xxx)


genius.remove_section_headers = True

artist = genius.search_artist(xxx)
artist.save_lyrics(extension = 'txt', binary_encoding=True)

Sometimes script can’t find lyrics to one song, passes it and goes to another one. But when saving file, it gives this error:

Error at line XX: Expected str instance nonetype found genius lyrics

How do I fix this error so I’m able to save the lyrics, even if one or more is missing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
allertercommented, Nov 2, 2020

This particular issue happens because we’re making a lot of requests and as you mentioned their API wasn’t made for lyrics, so we have to download each song page separately. This causes the number of requests to rise and time-outs are bound to happen when we make so many HTTP requests. In your case, the timeout happens when the package tries to fetch the full song info (because the get_full_info parameter is True), but at the same time, the package doesn’t handle the timeouts as it should. But all that is handled in the next version that’s coming out.

1reaction
allertercommented, Nov 2, 2020

You shouldn’t change the max_songs parameter as we’re adding the songs manually, so all we need is an empty Artist object. I edited the script above and improved it a bit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: sequence item 0: expected string, NoneType found
Within these lines, you've used a join statement multiple times. The join statement requires a list of strings in order to work. However,...
Read more >
TypeError: sequence item 1: expected string, NoneType found ...
I think this error is coming from utils._import_asnames and occurs because one of the import statements is not using as (e.g. import theano ......
Read more >
DNS config error "sequence item 0: expected str instance ...
I am using root@ubuntu:/snap/maas/current# snap list Name Version Rev Tracking Publisher Notes core18 20220428 2409 latest/stable ...
Read more >
TypeError: sequence item 0: expected string, NoneType found
i have no idea why this error is popping up i have'nt edited anything in those files can anyone explain me please!
Read more >
libinput-replay exception "TypeError: sequence item 0 ...
libinput-replay exception "TypeError: sequence item 0: expected str instance, NoneType found" · Summary · Fix · Steps to reproduce · Required ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found