catch curses setupterm errors

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2643 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-06-07 10:38:33 +00:00
parent 6cfe4f1058
commit d965a387d5

View file

@ -147,13 +147,17 @@ def has_colors (fp):
#return has_colors_nt()
try:
import curses
except ImportError:
# no curses available
return False
try:
curses.setupterm()
if curses.tigetnum("colors") >= 8:
# more than 8 colors: allright!
return True
except ImportError:
# no curses :(
pass
except curses.error:
# initialize error, eg. no terminfo database found
return False
return False