AttributeError:'NoneType'对象没有属性'fileno'诅咒模块错误

时间:2019-09-20 19:27:43

标签: python windows python-curses

我收到有关curses.initscr的错误。我该怎么办?

import curses

screen = curses.initscr()
curses.noecho
curses.cbreak
screen.keyboard(True)

try:
    while True:
        char = screen.getch()
        if char == ord("a"):
            print('Forward')
finally:
    curses.nobreak()
    screen.keypad(0)
    curses.echo()
    curses.endwin()

错误:

Traceback (most recent call last):
  File "C:\Python\Python3\PythonWork\Test1.py", line 24, in <module>
    screen = curses.initscr()
  File "C:\Python\Python37\lib\curses\__init__.py", line 30, in initscr fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'

这是什么意思?

我在Windows上工作,但设法在其上安装了curses模块。

0 个答案:

没有答案