You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reading history file fails with non-latin chars on Windows #55
On Windows and Python 3-6, reading history file that contains non-Latin chars fails with this error:
$ python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site.py", line 418, in register_readline
readline.read_history_file(history)
File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
self.mode._history.read_history_file(filename)
File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
for line in open(filename, 'rt'):
File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\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 0x8f in position 1818: character maps to <undefined>
Activity
fix(hist, pyreadline#55): reading history-files was leaking & failing…
jackz314 commentedon Jan 27, 2021
I don't think this repo is still being maintained, it's also sad that relevant bugs reported to Python point back to this issue from years ago.
fix(hist, pyreadline#55): reading history-files was leaking & failing…
eabase commentedon Jan 24, 2022
@ankostis
What is io doing differently?
Please consider adding fixes to new pyreadline3 from #76
ankostis commentedon Jan 24, 2022
I guess it is from the Python-2.7 era, when
open()did not support the encoding argument.If readline3 is Python-3 only, then plain
open()suffices.fix(hist, pyreadline#55): r/w history-files leaked & failed on non-La…
fix(hist,pyreadline#1): r/w history-files leaked & failed on non-Latin >
enh(utf,pyreadline#1) properly rw hist-file with io.open() >
FIX(enc,pyreadline#51) fallback encoding ASCII-->UTF-8 >
fix(hist,pyreadline#1): r/w history-files leaked & failed on non-Latin >
enh(utf,pyreadline#1) properly rw hist-file with io.open() >
FIX(enc,pyreadline#1) fallback encoding ASCII-->UTF-8 >
fix(hist,pyreadline3#1): r/w history-files leaked & failed on non-Lat…
enh(utf,pyreadline3#1) properly rw hist-file with io.open() >
FIX(enc,pyreadline3#1) fallback encoding ASCII-->UTF-8 >
fix(pyreadline3#6): r/w history-files leaked & failed on non-Latin >
enh(pyreadline3#6) properly rw hist-file with io.open() >
FIX(pyreadline3#6) fallback encoding ASCII-->UTF-8 >
FIX(pyreadline3#6) fallback encoding ASCII-->UTF-8 >
fix(hist, pyreadline#55): reading history-files was leaking & failing…