summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-01-20 00:57:26 +0100
committermathieui <mathieui@mathieui.net>2015-01-20 00:57:26 +0100
commita2678b02d95fc82755018c95ed5e006dca235caf (patch)
treed42d6df6d7cc46c1c36a73a8fda50b6a7e17c240
parentc580840d772937d26fd5ed44d6fcc9dbead63426 (diff)
downloadpoezio-a2678b02d95fc82755018c95ed5e006dca235caf.tar.gz
poezio-a2678b02d95fc82755018c95ed5e006dca235caf.tar.bz2
poezio-a2678b02d95fc82755018c95ed5e006dca235caf.tar.xz
poezio-a2678b02d95fc82755018c95ed5e006dca235caf.zip
Add a check for python ncurses unicode support
Exit almost gracefully instead of generating gigabytes of error logs. TODO: pressure the python maintainers into dropping ncurses and curses support, and use ncursesw only instead.
-rw-r--r--src/core/core.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/core.py b/src/core/core.py
index 807ca0cc..05db7e0e 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -494,6 +494,19 @@ class Core(object):
Init curses, create the first tab, etc
"""
self.stdscr = curses.initscr()
+ if not hasattr(self.stdscr, 'get_wch'):
+ curses.echo()
+ curses.endwin()
+ print('ERROR: The current python executable is linked with a '
+ 'ncurses version with no unicode capabilities.\nThis'
+ ' means python was built on a system where readline'
+ ' is linked against libncurses and not libncursesw.\n'
+ 'Please file a bug for your distribution or recompile'
+ ' libreadline with -ltermcapw instead of -ltermcap, '
+ 'and then recompile python.\nPoezio is currently unable'
+ ' to read your input or draw its interface properly, so'
+ ' it will now exit.')
+ self.exit()
self.init_curses(self.stdscr)
self.call_for_resize()
default_tab = tabs.RosterInfoTab()