From ed7188e2ba5d82ea65c68b735700b63c732e4691 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 6 Oct 2021 18:19:23 +0200 Subject: [PATCH] check both imports --- tmtc_client_cli.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/tmtc_client_cli.py b/tmtc_client_cli.py index c7cbf6d..ba29c2e 100755 --- a/tmtc_client_cli.py +++ b/tmtc_client_cli.py @@ -27,24 +27,36 @@ limitations under the License. @author R. Mueller """ import sys +try: + from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler + from tmtccmd.ccsds.handler import CcsdsTmHandler + from tmtccmd.utility.logger import TMTC_LOGGER_NAME +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print('Python tmtccmd submodule could not be imported') + print( + 'Install with \"cd tmtccmd && python3 -m pip ' + 'install -e .[gui]\" for interactive installation' + ) + sys.exit(1) + +try: + import spacepackets + from spacepackets.log import set_custom_console_logger_name +except ImportError as error: + print(error) + print('Python spacepackets module could not be imported') + print( + 'Install with \"cd spacepackets && python3 -m pip intall -e .\" for interative installation' + ) + sys.exit(1) from config.hook_implementations import EiveHookObject from config.version import __version__ from config.definitions import PUS_APID from pus_tm.factory_hook import ccsds_tm_handler -try: - from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler - from tmtccmd.ccsds.handler import CcsdsTmHandler - from tmtccmd.utility.logger import TMTC_LOGGER_NAME - import spacepackets - from spacepackets.log import set_custom_console_logger_name -except ImportError as error: - run_tmtc_commander = None - initialize_tmtc_commander = None - print(error) - print("Python tmtccmd submodule could not be imported") - print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") - sys.exit(0) def main():