From d77558eaedc259e0ec8cda703c74e76177c95884 Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:02:52 +0530 Subject: [PATCH] Fixed an issue related to non-existent standard input --- main.py | 5 +++-- store/constants.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e834c63..a79dacb 100644 --- a/main.py +++ b/main.py @@ -17,6 +17,7 @@ import sys import time import urllib.parse +isInteractive = sys.stdin and sys.stdin.isatty() plexAlertListeners: list[PlexAlertListener] = [] try: @@ -53,7 +54,7 @@ try: logger.info("Authentication successful.") serverName = os.environ.get("PLEX_SERVER_NAME") if not serverName: - serverName = input("Enter the name of the Plex Media Server you wish to connect to: ") if sys.stdin.isatty() else "ServerName" + serverName = input("Enter the name of the Plex Media Server you wish to connect to: ") if isInteractive else "ServerName" config["users"].append({ "token": authCheckResponse["authToken"], "servers": [{ "name": serverName }] }) saveConfig() break @@ -62,7 +63,7 @@ try: logger.info("Authentication failed.") exit() plexAlertListeners = [PlexAlertListener(user["token"], server) for user in config["users"] for server in user["servers"]] - if sys.stdin.isatty(): + if isInteractive: while True: userInput = input() if userInput in ["exit", "quit"]: diff --git a/store/constants.py b/store/constants.py index 78b30d2..1524ecd 100644 --- a/store/constants.py +++ b/store/constants.py @@ -2,7 +2,7 @@ import os import sys name = "Discord Rich Presence for Plex" -version = "2.3.4" +version = "2.3.5" plexClientID = "discord-rich-presence-plex" discordClientID = "413407336082833418"