2011-11-21 102 views
1

tigetstr后我升级Ubuntu的我的Python改为2.6.6和打电话时我app.py不辍 误差与诅咒在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吗?

回答

1

documentation

curses.tigetstr(capname)

返回对应于terminfo的功能名capname字符串能力的值。如果capname不是字符串能力,则不返回 ,或者在终端描述中没有被取消或不存在 。

我把它的问题可能与终端描述有关。 我在Ubuntu 11.10上运行的Python 2.7.2和下面的代码不会引发任何异常:

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

这是否对你的工作?如果是的话,你的问题可能需要在拨打curses.tigestr之前进行一些终端设置...

+0

这对我不起作用,但我正在做另一次Ubuntu升级。 – xralf

+0

Python'2.7.2'确定。 – xralf