From: Jean-Philippe ARGAUD Date: Sun, 11 Oct 2020 10:13:43 +0000 (+0200) Subject: Minor corrections for particular file and system support X-Git-Tag: V9_6_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d15b67bed58051bd93e3ae300bbbf355720cd428;p=modules%2Fadao.git Minor corrections for particular file and system support --- 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])