magmax / python-readchar

Python library to read characters and key strokes
MIT License
143 stars 45 forks source link

readchar.readchar() seems to return bytes instead of a string #37

Closed jacobcarpenter closed 2 years ago

jacobcarpenter commented 6 years ago

The documentation for readchar states:

Reads the next char from stdin, returning it as a string with length 1.

However, it appears to return a byte sequence:

example.py:

import readchar

print("Press a key")
pressed = readchar.readchar()

print(type(pressed))

Output:

$ python example.py
Press a key
<class 'bytes'>

This is using

$ pip show readchar
Name: readchar
Version: 2.0.1
Summary: Utilities to read single characters and key-strokes
Home-page: https://github.com/magmax/python-readchar
Author: Miguel Ángel García
Author-email: miguelangel.garcia@gmail.com
License: MIT

on Windows in a Git Bash prompt.

Cube707 commented 2 years ago

fixed in v4.0.0