Python _curses.error: setupterm: could not find terminfo database
I'm receiving the following error while attempting to debug/run a curses based Python script on OS X 10.8.2, IDEA Ultimate 11.1.3, Python plugin 2.9.2, and Python SDK 2.7.2. I can execute the script from a terminal session without any problem. Is there a workaround for this issue to allow debugging within IDEA?
pydev debugger: starting
Traceback (most recent call last):
File "/Users/jamesallman/Library/Application Support/IntelliJIdea11/python/helpers/pydev/pydevd.py", line 1401, in <module>
debugger.run(setup['file'], None, None)
File "/Users/jamesallman/Library/Application Support/IntelliJIdea11/python/helpers/pydev/pydevd.py", line 1055, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/Users/jamesallman/IdeaProjects/python/menu/menu.py", line 36, in <module>
wrapper(main)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/wrapper.py", line 22, in wrapper
stdscr = curses.initscr()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/__init__.py", line 33, in initscr
fd=_sys.__stdout__.fileno())
_curses.error: setupterm: could not find terminfo database
Here is the basic code to cause the error:
import curses
from curses.wrapper import wrapper
def main(scr):
scr.box()
scr.refresh()
c = scr.getch()
wrapper(main)
Please sign in to leave a comment.
Most likely the TERMINFO environment variable, which specifies the path to the terminfo database, is set in your .bash_profile file or in another file which is not visible to PyCharm when you run it from a desktop shortcut. The easiest workaround is to define the TERMINFO environment variable in the run configuration settings in PyCharm.
Any resolution to this problem yet? I am using iPython with PyPy inside a project created by virtualenv on my mac at "/Users/admin/web_projects/apps/blog".
Following is the traceback I get when I try to launch the Python console from 'Run' in PyCharm 2.5.1:
/Users/admin/web_projects/apps/blog/bin/pypy -u /Applications/PyCharm.app/helpers/pydev/pydevconsole.py 50513 50514
PyDev console: using IPython 0.13.2
Traceback (most recent call last):
File "app_main.py", line 72, in run_toplevel
File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 361, in <module>
StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 288, in StartServer
interpreter = InterpreterInterface(host, client_port, threading.currentThread())
File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console.py", line 37, in __init__
self.interpreter = PyDevFrontEnd()
File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console_011.py", line 35, in __init__
shell = TerminalInteractiveShell.instance()
File "/Users/admin/web_projects/apps/blog/site-packages/IPython/config/configurable.py", line 318, in instance
inst = cls(*args, **kwargs)
File "/Users/admin/web_projects/apps/blog/site-packages/IPython/frontend/terminal/interactiveshell.py", line 360, in __init__
user_module=user_module, custom_exceptions=custom_exceptions
File "/Users/admin/web_projects/apps/blog/site-packages/IPython/core/interactiveshell.py", line 454, in __init__
self.init_readline()
File "/Users/admin/web_projects/apps/blog/site-packages/IPython/core/interactiveshell.py", line 1843, in init_readline
self.refill_readline_hist()
File "/Users/admin/web_projects/apps/blog/site-packages/IPython/core/interactiveshell.py", line 1851, in refill_readline_hist
self.readline.clear_history()
File "/tmp/python_packages/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 284, in clear_history
del self.get_reader().history[:]
File "/tmp/python_packages/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 188, in get_reader
console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING)
File "/tmp/python_packages/pypy-2.0.2/lib_pypy/pyrepl/unix_console.py", line 98, in __init__
curses.setupterm(term, self.output_fd)
error: setupterm: could not find terminfo database
Process finished with exit code 1
Couldn't connect to console process.
So, it did detect the iPython in the bin directory. How and where do I set the TERMINFO env variable and what do I set it to ?
This still doesn't work -- OS X. I've edited the run/debug configuration to set environment variables TERM to xterm-256colors, and TERMINFO=/usr/share/terminfo. I no longer get "could not find terminfo database", but instead I get "_curses.error: cbreak() returned ERR", "During handling of the above exception, another exception occurred: .......... _curses.error: nocbreak() returned ERR". after calling curses.wrapper(my_callable).
Is it possible to run and debug a Python curses app/script in PyCharm? or does one have to remote-debug it?