Drekin / win-unicode-console

A Python package to enable Unicode support when running Python from Windows console.
MIT License
103 stars 12 forks source link

EOFError() when using raw_input() on certain input in Windows #41

Closed Nandaka closed 6 years ago

Nandaka commented 6 years ago

Hi,

I'm using Windows and Python 2.7. with win_unicode_console 0.5

Some input will raise EOFError, when other doesn't.

Sample code

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

import win_unicode_console
win_unicode_console.enable()

try:
    input = raw_input('input?')

    print input
except:
    print sys.exc_info()

Sample Input

Drekin commented 6 years ago

This is a pretty stupid bug. At the lowest level, the EOF was tested as a byte rather than as a Windows wide char. This causes EOF whenever the lower byte of the first character is b'\x1a', which is the case for your first input. It should be fixed now, try the latest development version.

Nandaka commented 6 years ago

Looks like it is working.

Thanks