From 7e1fc78f76fc5cf03e8d4588c66ea143fdc65023 Mon Sep 17 00:00:00 2001 From: smathis Date: Thu, 24 Oct 2024 10:49:18 +0200 Subject: [PATCH] Moved curses from top-level import to function-level import and added a comment why that is necessary --- utils/decodeMasterMACStatusR10.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/decodeMasterMACStatusR10.py b/utils/decodeMasterMACStatusR10.py index 26f71b2..a05f899 100755 --- a/utils/decodeMasterMACStatusR10.py +++ b/utils/decodeMasterMACStatusR10.py @@ -1,7 +1,5 @@ #!/usr/bin/env python3 -import curses - # List of tuples which encodes the states given in the file description. # Index first with the bit index, then with the bit value interpretation = [ @@ -42,6 +40,13 @@ def print_decoded(bit_list, interpreted): print(f"Bit {idx} = {bit_value}: {msg}") def interactive(): + + # Imported here, because curses is not available in Windows. Using the + # interactive mode therefore fails on Windows, but at least the single + # command mode can be used (which would not be possible if we would import + # curses at the top level) + import curses + stdscr = curses.initscr() curses.noecho() curses.cbreak()