By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Problems with curses.start_color()

P: n/a

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:

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

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/", 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/", line 229, in ?
sys.exit(curses.wrapper(main, *sys.argv[1:]))
File "/opt/app/g++lib6/python-2.4/lib/python2.4/curses/", line 44, in wrapper
return func(stdscr, *args, **kwds)
File "snake/scripts/", line 215, in main
File "/opt/app/g++lib6/python-2.4/lib/python2.4/curses/", line 41, in start_color
retval = _curses.start_color()
error: start_color() returned ERR

If I protect the call like so:


I get the first traceback again.

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


Apr 10 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.