简体   繁体   English

键盘和弦代码的错误消息:termios.error: (25, 'Inappropriate ioctl for device')

[英]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.

相关问题 詹金斯的pipenv shell返回问题termios.error:(25,&#39;不合适的设备ioctl&#39;) - pipenv shell in Jenkins return the issue termios.error: (25, 'Inappropriate ioctl for device') X 服务器“localhost:10.0”上的 matplot lib“致命 IO 错误 25(设备的 ioctl 不合适)” - matplot lib "fatal IO error 25 (Inappropriate ioctl for device) on X server "localhost:10.0" 崇高的tset:标准错误:设备的ioctl不适当 - Sublime tset: standard error: Inappropriate ioctl for device IOError:[Errno 25] 设备的 ioctl 不合适 - IOError: [Errno 25] Inappropriate ioctl for device OpenCV3错误:“无法停止流:设备的不适当的ioctl” - OpenCV3 error: “Unable to stop the stream: Inappropriate ioctl for device” 如何抑制“stty:'标准输入':设备的 ioctl 不合适”错误 - How to supress the “stty: 'standard input': Inappropriate ioctl for device” error 无法在 Pyserial 中打开串行连接:“termios.error: (22, &#39;Invalid argument&#39;)” - Can't open serial connection in Pyserial: "termios.error: (22, 'Invalid argument') " Pexpect和PyCharm - 适用于设备的ioctl - Pexpect and PyCharm - Inappropriate ioctl for device opencv无法阻止流:设备的ioctl不合适 - opencv Unable to stop the stream: Inappropriate ioctl for device 在Python中运行ioctl会返回ENOTTY-设备不适合的ioctl - Running ioctl in Python returns ENOTTY - inappropriate ioctl for device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM