[英]How to stop the error occuring in my Python curses code?
我很困惑为什么每当我运行一些诅咒代码时都会弹出这个错误。
代码:
import curses
stdscr = initscr()
Output:
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 的 Windows 版本不包括 curses 模块。 有一个名为 UniCurses 的移植版本可用。 您还可以尝试 Fredrik Lundh 编写的 Console 模块,它不使用与 curses 相同的 API,但提供光标可寻址文本 output 并完全支持鼠标和键盘输入。
将 your.py 文件放在启用了 PATH 的任何位置(它应该是 python 文件夹作为标准)
pip 安装 windows-curses
右键单击开始>运行
输入文件名(例如snake.py)
跑
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.