Problems with curses.start_color()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skip@pobox.com

    #1

    Problems with curses.start_color()


    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 (KeyboardInterr upt, SystemExit):
    sys.exit(0)

    According to the docs, curses.wrapper( ) calls curses.start_co lor(), 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_pa ir(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_co lor()
    File "/opt/app/g++lib6/python-2.4/lib/python2.4/curses/__init__.py", line 41, in start_color
    retval = _curses.start_c olor()
    error: start_color() returned ERR

    If I protect the call like so:

    try:
    curses.start_co lor()
    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
Working...