Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined> #2672

Closed
lazka opened this issue Dec 29, 2017 · 4 comments
Labels
Milestone

Comments

@lazka
Copy link
Member

@lazka lazka commented Dec 29, 2017

https://sentry.io/quodlibet/quodlibet/issues/425434407/

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined>
  File "quodlibet/qltk/songsmenu.py", line 156, in __on_activate
    self.__handle(item, plugin, library, songs, parent)
  File "quodlibet/qltk/songsmenu.py", line 216, in __handle
    if any(ret):
  File "quodlibet/ext/songsmenu/importexport.py", line 153, in plugin_album
    for line in open(fn, 'rU'):
  File "cp1252.py", line 23, in decode

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined>
@lazka lazka added the sentry label Dec 29, 2017
@lazka
Copy link
Member Author

@lazka lazka commented Dec 29, 2017

I guess I forgot to review the open() calls :/

@lazka lazka closed this in 396ee9e Jan 1, 2018
@lazka lazka added this to the 4.0.1 milestone Jan 4, 2018
lazka added a commit that referenced this issue Jan 10, 2018
Fixes #2671

So we do the same thing independent of the locale.
Also remove the universal newline flag, as it's the default with Python 3.
@futurespoir
Copy link

@futurespoir futurespoir commented Jun 6, 2018

You have to find the correct encoding. Common ones are Latin-1 and UTF-8. and you have to specify the encoding when you open the file:
exemple :
file = open(filename, encoding="utf8")

@odog96
Copy link

@odog96 odog96 commented Aug 13, 2020

Thanks! I was completely lost... this helps!

@SandipSPatil
Copy link

@SandipSPatil SandipSPatil commented Aug 28, 2020

Please help me out from this error in python 3.7.9
2020-08-28:21:46:43,143 INFO [iwn.py:43] Loading hindi language synsets...
Traceback (most recent call last):
File "D:\Ph D\WSD\Review Paper Outline RRC and Paper-III Seminar\Progress Report\Progress Report-III\New folder\1.py", line 13, in
iwn=pyiwn.IndoWordNet(lang=pyiwn.Language.HINDI)
File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 45, in init
self._synset_df = self._load_synset_file(lang.value)
File "C:\Python\lib\site-packages\pyiwn\iwn.py", line 51, in _load_synset_file
synsets = list(map(lambda line: self._load_synset(line), f.readlines()))
File "C:\Python\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 13: character maps to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants