diff --git a/enki.py b/enki.py index f6cd36c..55724d7 100755 --- a/enki.py +++ b/enki.py @@ -5,7 +5,10 @@ import argparse import signal -from sparkplug_b_pb2 import Payload +try: + from sparkplug_b_pb2 import Payload +except ImportError: + from tahu.python.core.sparkplug_b_pb2 import Payload from mqtt_if import MQTTInterface from sp_topic import SPTopic diff --git a/shell.py b/shell.py index 0111104..96d79c5 100644 --- a/shell.py +++ b/shell.py @@ -5,8 +5,14 @@ import cmd2 -import sparkplug_b_pb2 -from sparkplug_b import MetricDataType, addMetric, addNullMetric, initDatasetMetric +try: + import sparkplug_b_pb2 + from sparkplug_b import MetricDataType, addMetric + from sparkplug_b import addNullMetric, initDatasetMetric +except ImportError: + import tahu.python.core.sparkplug_b_pb2 + from tahu.python.core.sparkplug_b import MetricDataType, addMetric + from tahu.python.core.sparkplug_b import addNullMetric, initDatasetMetric import sp_helpers from sp_helpers import MsgType diff --git a/sp_helpers.py b/sp_helpers.py index 9e588bb..3eb15b3 100644 --- a/sp_helpers.py +++ b/sp_helpers.py @@ -4,7 +4,10 @@ from typing import Optional from enum import Enum -from sparkplug_b import MetricDataType +try: + from sparkplug_b import MetricDataType +except ImportError: + from tahu.python.core.sparkplug_b import MetricDataType # Sparkplug namespace used