Python 2.6.6中curses tigetstr出错

2024-05-20 02:31:27 发布

您现在位置:Python中文网/ 问答频道 /正文

在我升级了Ubuntu之后,我的Python被改为2.6.6应用程序副本停止工作 打电话时

sys.stdout.write(curses.tigetstr('civis'))

它写道:

Traceback (most recent call last):
  File "app.py", line 60, in <module>
    sys.stdout.write(curses.tigetstr('civis'))
TypeError: argument 1 must be string or read-only character buffer, not None

我应该为更新版本的Python更改代码吗?在


Tags: 应用程序mostubuntustdoutsys副本callcurses
1条回答
网友
1楼 · 发布于 2024-05-20 02:31:27

正在读取documentation

curses.tigetstr(capname)

Return the value of the string capability corresponding to the terminfo capability name capname. None is returned if capname is not a string capability, or is canceled or absent from the terminal description.

我想问题可能出在终端描述上。 我在Ubuntu 11.10上运行Python2.7.2,以下代码没有引发任何异常:

import sys
import curses
curses.setupterm()
sys.stdout.write(curses.tigetstr('civis'))

这对你有用吗?如果是,您的问题可能与调用curses.tigestr之前的某些终端设置有关。。。在

相关问题 更多 >