1

Whenever I try to use the curses module for my robot(raspberry pi 3), I keep getting the error "setupterm: could not find terminal". What can I do to solve this? Please bear in mind I am new to Python and self taught.

    import curses


def initialise():
    screen = curses.initscr()
    curses.noecho()
    curses.cbreak
    screen.keypad(True)

def loop():
    while True:
        char = screen.getch()
        if char == ord('q'):
            break
        elif char == curses.KEY_UP:
            print("up")

if __name__ == '__main__':
    while True:
        initialise()
        loop()

`
Alex Mabey
  • 11
  • 3
  • 1
    How are you running your code? `curses` requires an actual display, which generally means an interactive console-based program. – Joe Dec 29 '17 at 13:03
  • I am just using IDLE – Alex Mabey Dec 29 '17 at 13:04
  • `curses` might not be your best choice then. what are you actually trying to accomplish by using it? – Joe Dec 29 '17 at 13:08
  • I am trying to get an input from my keyboard so that I can control a robot remotely(I don't want to press enter every time i want to do something) – Alex Mabey Dec 29 '17 at 13:17
  • Some ideas here, though note that almost none of them apparently work while running your code from inside IDLE - https://stackoverflow.com/questions/292095/polling-the-keyboard-detect-a-keypress-in-python – Joe Dec 29 '17 at 13:28

0 Answers0