| 59 | |
| 60 | |
| 61 | def configure_color(): |
| 62 | # Check availability of the termcolor library |
| 63 | try: |
| 64 | global colored |
| 65 | from termcolor import colored |
| 66 | |
| 67 | except (ImportError, ModuleNotFoundError): |
| 68 | logging.warning('termcolor module not installed. To show colored output, ' |
| 69 | 'install termcolor using: pip{} install termcolor'.format(sys.version_info.major)) |
| 70 | pass |
| 71 | |
| 72 | # Also check availability of the colorama library in case of Windows |
| 73 | try: |
| 74 | if os.name == 'nt': |
| 75 | import colorama |
| 76 | colorama.init() |
| 77 | except (ImportError, ModuleNotFoundError): |
| 78 | logging.warning('colorama module not installed. To show colored output in Windows, ' |
| 79 | 'install colorama using: pip{} install colorama'.format(sys.version_info.major)) |
| 80 | pass |
| 81 | |
| 82 | |
| 83 | class WesException(Exception): |