1

I'm making a Python program on a MacBook using the curses.textpad module. Here's my complete code:

import curses
from curses.textpad import Textbox, rectangle

def editor(stdscr):
    stdscr.addstr(0, 0, "Type something: (hit Ctrl-G to exit)")

    editor = curses.newwin(5, 30, 2, 1)
    rectangle(stdscr, 1, 0, 1 + 5 + 1, 1 + 30 + 1)
    stdscr.refresh()

    box = Textbox(editor)
    box.edit()

    message = box.gather()
    print(message)

text = curses.wrapper(editor)
print("Here's what you typed:")
print(text)

It keeps giving me this error whenever I try to run it:

Traceback (most recent call last):
  File "/Users/Donoru/Desktop/editor/main.py", line 17, in <module>
    text = curses.wrapper(editor)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/curses/__init__.py", line 84, in wrapper
    stdscr = initscr()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/curses/__init__.py", line 29, in initscr
    setupterm(term=_os.environ.get("TERM", "unknown"),
_curses.error: setupterm: could not find terminal

How can I fix this?

Donoru
  • 115
  • 1
  • 15
  • Does this answer your question? [Setupterm could not find terminal, in Python program using curses](https://stackoverflow.com/questions/9485699/setupterm-could-not-find-terminal-in-python-program-using-curses) – Seth Sep 21 '20 at 22:51

0 Answers0