After discussing this issue on github with the creator of the project - magmax (here), I understood that readchar package works only if you try to run it from a terminal but not from any IDE or other non terminal executions. The error is caused because it tries to get the terminal settings which is non existent in this case.

I have been trying to run it from an Wing IDE. The program works great if you try to run it from a terminal.

P.S: magmax suggested to use readchar.keys.ENTER instead of \r . And suggested to have a look at https://github.com/magmax/python-inquirer & its examples

Answer from inblueswithu on Stack Overflow
🌐
PyPI
pypi.org › project › readchar
readchar · PyPI
Library to easily read single chars and key strokes
      » pip install readchar
    
Published   Nov 04, 2024
Version   4.2.1
🌐
GitHub
github.com › magmax › python-readchar
GitHub - magmax/python-readchar: Python library to read characters and key strokes · GitHub
Python library to read characters and key strokes. Contribute to magmax/python-readchar development by creating an account on GitHub.
Starred by 176 users
Forked by 52 users
Languages   Python 99.1% | Makefile 0.9%
🌐
Anaconda.org
anaconda.org › conda-forge › readchar
readchar - conda-forge | Anaconda.org
$conda install conda-forge::readchar · Monthly · Downloads Updates · Version · 4.2.1 · 4.2.0 · 4.1.0 · 4.0.5 · 4.0.4 · 5 / 8 versions selected · Downloads (Last 6 months): 0 · Summary · Library to easily read single chars and key strokes · Last Updated · Jun 20, 2025 at 23:11 ...
🌐
GitHub
github.com › magmax › python-readchar › blob › master › readchar › key.py
python-readchar/readchar/key.py at master · magmax/python-readchar
Python library to read characters and key strokes. Contribute to magmax/python-readchar development by creating an account on GitHub.
Author   magmax
🌐
Snyk
snyk.io › advisor › readchar › functions › readchar.readkey
https://snyk.io/advisor/python/readchar/functions/...
#Only for Python 2.7 #Very Important!!!!!!!!! import readchar while True: key = readchar.readkey() if key == "w": print("up") elif key == "s": print("down") elif key == "a": print("left") elif key == "d": print("right") elif key == "z": print("exiting") break ·
🌐
GitHub
github.com › magmax › python-readchar › blob › master › readchar › _posix_key.py
python-readchar/readchar/_posix_key.py at master · magmax/python-readchar
Python library to read characters and key strokes. Contribute to magmax/python-readchar development by creating an account on GitHub.
Author   magmax
🌐
GitHub
github.com › magmax › python-readchar › blob › master › README.md
python-readchar/README.md at master · magmax/python-readchar
Python library to read characters and key strokes. Contribute to magmax/python-readchar development by creating an account on GitHub.
Author   magmax
Find elsewhere
🌐
GitHub
github.com › magmax › python-readchar › blob › master › Makefile
python-readchar/Makefile at master · magmax/python-readchar
Python library to read characters and key strokes. Contribute to magmax/python-readchar development by creating an account on GitHub.
Author   magmax
🌐
GitHub
github.com › trinketapp › python-readchar
GitHub - trinketapp/python-readchar: Python library to read characters and key strokes
Born as a python-inquirer requirement. The idea is to have a portable way to read single characters and key-strokes. ... The readchar library is compatible with python 2.6, 2.7, 3.3, 3.4 and 3.5.
Author   trinketapp
🌐
Pydigger
pydigger.com › pypi › readchar
readchar
September 11, 2022 - [![GitHub Repository](https://img.shields.io/badge/-GitHub-#0D0D0D?logo=github&labelColor=gray)](https://github.com/magmax/python-readchar) [![Latest PyPi version](https://img.shields.io/pypi/v/readchar.svg)](https://pypi.python.org/pypi/readchar) [![supported Python versions](https://img....
🌐
Arch Linux
aur.archlinux.org › packages › python-readchar
python-readchar - AUR (en) - Arch Linux
October 27, 2020 - ==> Making package: python-readchar 3.0.5-7 (Thu Jun 23 21:29:14 2022) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> WARNING: Using existing $srcdir/ tree ==> Starting build()... * Getting dependencies for wheel...
🌐
Synthiam
synthiam.com › docs › python api › file › readchar
readChar - File - Python API - Support - Synthiam
November 30, 2023 - File.readChar(filename) The character at the current read position of the file.
🌐
Snyk
snyk.io › advisor › python packages › readchar
readchar - Python Package Health Analysis | Snyk
March 24, 2021 - Library to easily read single chars and key strokes. Visit Snyk Advisor to see a full health score report for readchar, including popularity, security, maintenance & community analysis. The python package readchar receives a total of 870,688 weekly downloads.
🌐
PyPI
pypi.org › project › readchar › 0.7
readchar 0.7
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
FreshPorts
freshports.org › textproc › py-readchar
FreshPorts -- textproc/py-readchar: Python library to read characters and key strokes
Library to easily read single chars and key strokes. The idea is to have a portable way to read single characters and key-strokes.
🌐
Snyk
snyk.io › advisor › readchar › functions › readchar.readchar
How to use the readchar.readchar function in readchar | Snyk
Do this for as many angles as possible.") print() print("When you have done all the angles, press 2.") print("Press 0 to exit at any time.") while True: key = readchar.readchar() if key == "0": return elif key == "1": angle = float(input("Enter the angle: ")) servo_angle_pws.append([angle, pw]) elif key == "2": break elif key=="a": pw = pw - 10 elif key=="s": pw = pw + 10 elif key=="A": pw = pw - 1 elif key=="S": pw = pw + 1
🌐
GitHub
github.com › magmax › python-readchar › issues › 26
error in pip install readchar · Issue #26 · magmax/python-readchar
April 18, 2017 - platform: windows 10 python version: 3.6 I couldn't install library. Here's the output from console: pip install readchar --no-cache-dir Collecting readchar Downloading readchar-0.7.tar.gz ...
Author   siran