Moved curses from top-level import to function-level import and added a

comment why that is necessary
This commit is contained in:
2024-10-24 10:49:18 +02:00
parent 9e0d8a4322
commit 7e1fc78f76

View File

@ -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()