【发布时间】:2019-12-03 17:07:18
【问题描述】:
背景:
- 我最近用
pip install curses安装了curses - 我在网上找到了几个教程(https://www.devdungeon.com/content/curses-programming-python、https://docs.python.org/3/howto/curses.html、https://www.youtube.com/watch?v=rbasThWVb-c)
- 我总是在安装新包或学习新东西时不断测试运行我的代码
每当我在 IDLE 中运行 s = curses.initscr() 时,都会收到以下错误消息:
File "C:/Users/jacob/AppData/Local/Programs/Python/Python37-32/screentest.py", line 3, in <module>
s = curses.initscr()
File "C:\Users\jacob\AppData\Local\Programs\Python\Python37-32\lib\curses\__init__.py", line 30, in initscr
fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'
这是来自 PyCharm 的消息:
Redirection is not supported.
Process finished with exit code 1
当我从 DevDungeon 运行示例 sn-p 时,
print("Preparing to initialize screen...")
screen = curses.initscr()
print("Screen initialized.")
screen.refresh()
curses.napms(2000)
curses.endwin()
print("Window ended.")
在 python 启动的命令提示符下,它只是给出一个不可交互的空白屏幕。
shell 中发生的事情是否正确?
这到底是怎么回事?
我该如何解决这个问题?
请帮忙谢谢
【问题讨论】:
标签: python-3.x windows pycharm python-idle python-curses