我对为什么每次运行一些curses代码时都会不断弹出此错误感到困惑。
代码:
import curses
stdscr = initscr()
输出:
Traceback (most recent call last):
File "C:\Users\Abd-ur-Rahmaan\Desktop\Abd-Ur-Rahmaan Shabbir\Python coding\Python Advanced Shit\The first curses project\The first curses project.py", line 3, in <module>
stdscr = curses.initscr()
File "C:\Users\Abd-ur-Rahmaan\Desktop\lib\curses\__init__.py", line 30, in initscr
fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'
有人可以帮忙吗?
Windows版本的Python不包含curses模块。提供了一个名为UniCurses的移植版本。您也可以尝试使用Fredrik Lundh编写的Console模块,该模块不使用与curses相同的API,而是提供可光标定位的文本输出,并且完全支持鼠标和键盘输入。