Moved curses from top-level import to function-level import and added a
comment why that is necessary
This commit is contained in:
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import curses
|
|
||||||
|
|
||||||
# List of tuples which encodes the states given in the file description.
|
# List of tuples which encodes the states given in the file description.
|
||||||
# Index first with the bit index, then with the bit value
|
# Index first with the bit index, then with the bit value
|
||||||
interpretation = [
|
interpretation = [
|
||||||
@ -42,6 +40,13 @@ def print_decoded(bit_list, interpreted):
|
|||||||
print(f"Bit {idx} = {bit_value}: {msg}")
|
print(f"Bit {idx} = {bit_value}: {msg}")
|
||||||
|
|
||||||
def interactive():
|
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()
|
stdscr = curses.initscr()
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
curses.cbreak()
|
curses.cbreak()
|
||||||
|
Reference in New Issue
Block a user