有人可以帮我阻止错误(正文中显示错误消息吗?

问题描述 投票:0回答:1

我对为什么每次运行一些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'

有人可以帮忙吗?

python-3.x windows curses
1个回答
0
投票

Windows版本的Python不包含curses模块。提供了一个名为UniCurses的移植版本。您也可以尝试使用Fredrik Lundh编写的Console模块,该模块不使用与curses相同的API,而是提供可光标定位的文本输出,并且完全支持鼠标和键盘输入。

参考:https://docs.python.org/3/howto/curses.html

© www.soinside.com 2019 - 2024. All rights reserved.