From d15b67bed58051bd93e3ae300bbbf355720cd428 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sun, 11 Oct 2020 12:13:43 +0200 Subject: [PATCH] Minor corrections for particular file and system support --- src/daComposant/daCore/Interfaces.py | 5 ++++- src/daComposant/daCore/PlatformInfo.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/daComposant/daCore/Interfaces.py b/src/daComposant/daCore/Interfaces.py index 402557d..d6098ad 100644 --- a/src/daComposant/daCore/Interfaces.py +++ b/src/daComposant/daCore/Interfaces.py @@ -623,7 +623,10 @@ class ImportFromScript(object): __basename = __filename.rstrip(".py") PlatformInfo.checkFileNameImportability( __basename+".py" ) self.__basename = __basename - self.__filenspace = __import__(__basename, globals(), locals(), []) + try: + self.__filenspace = __import__(__basename, globals(), locals(), []) + except NameError: + self.__filenspace = "" with open(__filename,'r') as fid: self.__filestring = fid.read() def getvalue(self, __varname=None, __synonym=None ): diff --git a/src/daComposant/daCore/PlatformInfo.py b/src/daComposant/daCore/PlatformInfo.py index fd78c50..f08b80a 100644 --- a/src/daComposant/daCore/PlatformInfo.py +++ b/src/daComposant/daCore/PlatformInfo.py @@ -93,7 +93,7 @@ class PlatformInfo(object): if hasattr(platform, 'linux_distribution'): __msg += "\n%s%30s : %s" %(__prefix, "platform.linux_distribution",str(platform.linux_distribution())) - else: + elif hasattr(platform, 'dist'): __msg += "\n%s%30s : %s" %(__prefix,"platform.dist",str(platform.dist())) elif sys.platform.startswith('darwin'): if hasattr(platform, 'mac_ver'): @@ -104,7 +104,7 @@ class PlatformInfo(object): if (platform.mac_ver()[0].split('.')[1] == key): __msg += "\n%s%30s : %s" %(__prefix, "platform.mac_ver",str(platform.mac_ver()[0]+"(" + macosx_dict[key]+")")) - else: + elif hasattr(platform, 'dist'): __msg += "\n%s%30s : %s" %(__prefix,"platform.dist",str(platform.dist())) elif os.name == 'nt': __msg += "\n%s%30s : %s" %(__prefix,"platform.win32_ver",platform.win32_ver()[1]) -- 2.39.2