Fix curses import error handling
@@ -60,9 +60,15 @@ def max_colors():
if _COLORS is None:
try:
import curses
+ try:
curses.setupterm()
_COLORS = curses.tigetnum('colors')
- except (ImportError, OSError, curses.error):
+ except (OSError, curses.error):
+ pass
+ except ImportError:
+ pass
+
+ if _COLORS is None:
_COLORS = 1
return _COLORS
