title: Setupterm could not find terminal, in Python program using curses
body: <p>I am trying to get a simple curses script to run using Python (with PyCharm 2.0).</p>
  
  <p>This is my script:</p>
  
  <pre><code>import curses
  stdscr = curses.initscr()
  curses.noecho()
  curses.cbreak()
  stdscr.keypad(1)
  while 1:
      c = stdscr.getch()
      if c == ord('p'): print("I pressed p")
      elif c == ord('q'): break
  
  curses.nocbreak(); stdscr.keypad(0); curses.echo()
  curses.endwin()
  </code></pre>
  
  <p>When I run this from my IDE (PyCharm 2) I get the following error:</p>
  
  <pre>
  <code>
  _curses.error: setupterm: could not find terminal
  Process finished with exit code 1
  </code>
  </pre>
  
  <p>If I run the script from bash it will simply be stuck in the while loop not reacting to either pressing p or q.</p>
  
  <p>Any help would be appreciated.</p>