title: Python curses not displaying colors, whereas C ncurses works fine
body: <p>I can't seem to get the Python curses module to display colors, whereas the ncurses C library works fine. Here is a simple script that should work:</p>
  
  <pre><code>import curses
  
  def main(stdscr):
  
    if not curses.has_colors(): raise
    stdscr.addstr("Hello world\n", curses.color_pair(curses.COLOR_RED))
    stdscr.addstr("Press any key to exit.\n")
    stdscr.refresh()
    while stdscr.getch() == -1: pass
  
  if __name__ == '__main__':
    curses.wrapper(main)
  </code></pre>
  
  <p>I can only see "Press any key to exit.". I know "Hello world" is being written because of the new line, but I can't see the text. I attempted various color pairs, but only 0, i.e. white, works.</p>
  
  <p>Not using the wrapper, i.e.</p>
  
  <pre><code>  stdscr = curses.initscr()
    curses.start_color()
    main(stdscr)
    curses.endwin()
  </code></pre>
  
  <p>Didn't help.</p>
  
  <p>I tested it on XTerm(312), which has a black bg, and urxvt v9.20, which has a white one. I am on Debian jessie, using bash and Python 2.7.</p>
  
  <p>I ran an old C script I had that uses ncurses and it displays colors nicely, so I assume either I'm doing something wrong or there's something wrong with the python library. I downloaded a package called colortest-python and it was able to display color too, although it doesn't use curses to do so (only to test if the terminal is capable of displaying colors).</p>