From 3c8061dbbb866bdc6fce7e61d977747fdb2d956a Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Sun, 23 Oct 2022 11:19:22 +0200 Subject: [PATCH] Allow get_gamm_version() failure --- bin/gammu_get_unread_sms.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/gammu_get_unread_sms.py b/bin/gammu_get_unread_sms.py index a8b0761..30e782f 100755 --- a/bin/gammu_get_unread_sms.py +++ b/bin/gammu_get_unread_sms.py @@ -4,7 +4,7 @@ # (C) 2003 - 2018 Michal Čihař - python-gammu # (C) 2015 - 2021 Raspian France - RaspianFrance/raspisms -# (C) 2022 Orsiris de Jong - NetInvent SASU +# (C) 2022 - Orsiris de Jong - NetInvent SASU from __future__ import print_function @@ -215,11 +215,14 @@ if __name__ == "__main__": # We need to check if we have gammu >= 1.42.0 since deleting sms with lower versions fail with: # Cannot delete sms: {'Text': 'The type of memory is not available or has been disabled.', 'Where': 'DeleteSMS', 'Code': 81} # see https://github.com/gammu/gammu/issues/460 - gammu_version = get_gammu_version() - if gammu_version[0] >= 1 and gammu_version[1] >= 42: - delete = True - else: - logger.warning("Cannot delete SMS. You need gammu >= 1.42.0.") - + try: + gammu_version = get_gammu_version() + if gammu_version[0] >= 1 and gammu_version[1] >= 42: + delete = True + else: + logger.warning("Cannot delete SMS. You need gammu >= 1.42.0.") + except TypeError: + logger.warning("Cannot get gammu version. SMS Deleting might not work properly.") + show_read = args.show_read main(config_file, delete, show_read)