From 7e17f9e2ad23b53711772dcf782b8d382fd38bc2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 28 Oct 2021 19:19:37 +1000 Subject: [PATCH] ignore a spurious mypy error --- qt/aqt/package.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qt/aqt/package.py b/qt/aqt/package.py index 65a30968a..1cee7d5b4 100644 --- a/qt/aqt/package.py +++ b/qt/aqt/package.py @@ -61,8 +61,11 @@ def packaged_build_setup() -> None: _patch_pkgutil() # escape hatch for debugging issues with packaged build startup - if os.getenv("ANKI_STARTUP_REPL") and os.isatty(sys.stdin.fileno()): - import code + if os.getenv("ANKI_STARTUP_REPL"): + # mypy incorrectly thinks this does not exist on Windows + is_tty = os.isatty(sys.stdin.fileno()) # type: ignore + if is_tty: + import code - code.InteractiveConsole().interact() - sys.exit(0) + code.InteractiveConsole().interact() + sys.exit(0)