[英]Error message for keyboard-chord code: termios.error: (25, 'Inappropriate ioctl for device')
I'm a python beginner, and I was recently trying to code a program that required the readchar module.我是 python 初学者,最近我试图编写一个需要 readchar 模块的程序。 However, I kept getting the error message:
但是,我不断收到错误消息:
termios.error: (25, 'Inappropriate ioctl for device')
I've tried adjusting my code, but I keep getting the same error message.我试过调整我的代码,但我不断收到相同的错误消息。 Here is my code:
这是我的代码:
import readchar
while True:
print(readchar.readkey())
(This is the full error message.) (这是完整的错误消息。)
Traceback (most recent call last):
File "/Users/larajean/PycharmProjects/thegreatesthits/chordKeyboard.py", line 7, in <module>
chord = readchar.readkey()
File "/Users/larajean/PycharmProjects/thegreatesthits/venv/lib/python2.7/site-packages/readchar/readchar.py", line 20, in readkey
c1 = getchar()
File "/Users/larajean/PycharmProjects/thegreatesthits/venv/lib/python2.7/site-packages/readchar/readchar_linux.py", line 12, in readchar
old_settings = termios.tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')
I am using a PyCharm IDE and a version of Python 2.7.我使用的是 PyCharm IDE 和 Python 2.7 版本。 Any suggestions on how to fix this problem?
有关如何解决此问题的任何建议?
You need to enable Emulate terminal in output console
setting in the run configurations section of PyCharm to make it compatible with termios
.您需要在 PyCharm 的运行配置部分的
Emulate terminal in output console
以使其与termios
兼容。
To get there, either right click in the file editor then click Modify Run Configuration...
要到达那里,请右键单击文件编辑器,然后单击
Modify Run Configuration...
Or go to the menu bar > Run
> Edit Configurations
或者go到菜单栏>
Run
> Edit Configurations
Then in the Execution
section, enable the Emulate terminal in output console
setting and apply.然后在
Execution
部分, Emulate terminal in output console
并应用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.