Problems with curses.start_color()

S

skip

Environment: Solaris 10, Python 2.4.2.

I'm trying to convert a very simple (display-wise) program to use curses.
This is my first try at using curses. I have wrapped my main:

try:
sys.exit(curses.wrapper(main, *sys.argv[1:]))
except (KeyboardInterrupt, SystemExit):
sys.exit(0)

According to the docs, curses.wrapper() calls curses.start_color(), but if I
don't call it myself I get this traceback when I try to use colors:

Traceback (most recent call last):
File "snake/scripts/message-tracker.py", line 141, in display
attr = curses.color_pair(0)
error: must call start_color() first

If I call start_color() unconditionally I get this error:

Traceback (most recent call last):
File "snake/scripts/message-tracker.py", line 229, in ?
sys.exit(curses.wrapper(main, *sys.argv[1:]))
File "/opt/app/g++lib6/python-2.4/lib/python2.4/curses/wrapper.py", line 44, in wrapper
return func(stdscr, *args, **kwds)
File "snake/scripts/message-tracker.py", line 215, in main
curses.start_color()
File "/opt/app/g++lib6/python-2.4/lib/python2.4/curses/__init__.py", line 41, in start_color
retval = _curses.start_color()
error: start_color() returned ERR

If I protect the call like so:

try:
curses.start_color()
except:
pass

I get the first traceback again.

A quick Google search didn't turn this up as an obvious problem. What have
I missed?

Thx,

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,775
Messages
2,569,601
Members
45,182
Latest member
BettinaPol

Latest Threads

Top