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.

Encoding error during saving of lyrics for an artist

See original GitHub issue

I tried fetching the lyrics of the french rapper Nekfeu and saving them in txt format but I got that error Traceback (most recent call last): File "lyrics_fetch.py", line 6, in <module> artist.save_lyrics(format = "txt") File "D:\Anaconda3\lib\site-packages\lyricsgenius\artist.py", line 134, in save_lyrics lyrics_file.write(lyrics_to_write) File "D:\Anaconda3\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 20121: character maps to <undefined>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
devspaceshipcommented, Apr 10, 2018

Yeah encoding errors seems to be a pain in the ass, I also had a problem with another artist where it couldn’t map ō so I decided to use an ugly but working solution for the moment, I simply replaced lyrics_file.write(lyrics_to_write) by print(lyrics_to_write) and copied and pasted from the console but I’ll try to think about a solution ( lyrics_file.write(lyrics_to_write.encode(encoding = 'utf-8', errors = 'ignore').decode(encoding = 'utf-8')) didn’t work either)

0reactions
johnwmillrcommented, Sep 8, 2018

Closed by #51. The encoding issues are sure to crop up again in the future though…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue With Encoding Character '\u2005' For Song "Closed on ...
Expected save to requested text file with no issue. This occured while trying to save lyrics for the song "Closed on Sunday" by...
Read more >
Java 17 Encoding error during compilation - Stack Overflow
I have a ReaderWriter.java class that is giving encoding errors. ... Encode in the child using the charset "-Dsun.stderr.encoding=" + ...
Read more >
Analyzing lyrics from different music genres with universal ...
Applying Google's Universal Sentence Encoder and Principal Component Analysis to identify similarities and differences across music genres.
Read more >
3.3.3 Special characters - LilyPond Notation Reference
This means that any text, be it title, lyric text, or musical instruction containing non-ASCII characters, must be encoded in UTF-8.
Read more >
[RELEASE] LRC Lyrics - Addon based on XBMC Lyrics
fixed: encoding error when login as non english user name under windows ... added: setting "Save lyrics files in artist folder"
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