From fdfb18a78e0014d362a2e0654eabf706094e4f09 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sat, 30 Sep 2017 18:44:45 +0000 Subject: Check if termios is present or ignore termios is POSIX specific which doesn't work for Windows users using the CLI. Check for the presence of termios and disable the set_echo function if it's not present. The only reason echo is disabled during polling is to prevent control characters entered by a user from displaying in the playlist so it's more cosmetic than anything. --- pydora/utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pydora/utils.py b/pydora/utils.py index 47422d6..3c48117 100644 --- a/pydora/utils.py +++ b/pydora/utils.py @@ -2,10 +2,15 @@ from __future__ import print_function import os import sys -import termios import getpass import subprocess +try: + import termios +except ImportError: + # Windows does not have a termios module + termios = None + def input(prompt): try: @@ -39,6 +44,9 @@ class Screen(object): @staticmethod def set_echo(enabled): + if not termios: + return + handle = sys.stdin.fileno() if not os.isatty(handle): return -- cgit v1.2.3