magmax / python-readchar

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

getkey not working on mac #29

Closed russlamb closed 6 years ago

russlamb commented 6 years ago

My code is like this


import readchar

def console_loop():
    while True:
        key = readchar.readkey()
        print(key)

def main():
    console_loop()

I get the following error.

Traceback (most recent call last):
  File "/Users/current_user/Dropbox/Coding/Python/current_project/main.py", line 19, in <module>
    main()
  File "/Users/current_user/Dropbox/Coding/Python/current_project/main.py", line 11, in main
    console_loop()
  File "/Users/current_user/Dropbox/Coding/Python/current_project/main.py", line 7, in console_loop
    key = readchar.readkey()
  File "/Users/current_user/.virtualenvs/current_project/lib/python3.5/site-packages/readchar/readchar.py", line 20, in readkey
    c1 = getchar()
  File "/Users/current_user/.virtualenvs/current_project/lib/python3.5/site-packages/readchar/readchar_linux.py", line 12, in readchar
    old_settings = termios.tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')
russlamb commented 6 years ago

i installed readchar-0.7 using pip

felzix commented 6 years ago

I think this should be closed because I am running mac with readchar==2.0.1 and it works fine.

magmax commented 6 years ago

thank you very much for the feedback