Make dotmap (via meshtastic.test) and print_color optional

This commit is contained in:
Ian McEwen
2024-12-12 20:59:22 -07:00
parent 89b41c1a19
commit 31f322f1c2
5 changed files with 24 additions and 13 deletions

View File

@@ -15,7 +15,11 @@ from decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Union
import google.protobuf.json_format
import print_color # type: ignore[import-untyped]
try:
import print_color # type: ignore[import-untyped]
except ImportError as e:
print_color = None
from pubsub import pub # type: ignore[import-untyped]
from tabulate import tabulate
@@ -153,7 +157,7 @@ class MeshInterface: # pylint: disable=R0902
@staticmethod
def _printLogLine(line, interface):
"""Print a line of log output."""
if interface.debugOut == sys.stdout:
if print_color is not None and interface.debugOut == sys.stdout:
# this isn't quite correct (could cause false positives), but currently our formatting differs between different log representations
if "DEBUG" in line:
print_color.print(line, color="cyan", end=None)