mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-10 07:34:44 +00:00
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:
parent
6cfe4f1058
commit
d965a387d5
1 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue