# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
def importPlugins(self):
"""Execute the salome_plugins file that contains plugins definition """
+ ior_fake_ns = None
+ prefix_ior = "--iorfakens="
+ presence_ior = [elt for elt in QApplication.arguments() if elt[:len(prefix_ior)]==prefix_ior]
+ if any(presence_ior):
+ ior_fake_ns = presence_ior[-1][len(prefix_ior):]
if self.lasttime ==0 or salome.myStudy == None:
- salome.salome_init(embedded=True)
+ salome.salome_init(embedded=True,iorfakensfile=ior_fake_ns)
lasttime=0
sys.path.insert(0,directory)
logger.debug("The directory %s has been added to PYTHONPATH"%directory)
try:
- exec(compile(open(plugins_file,'rb').read(), plugins_file, 'exec'),globals(),{})
+ with open(plugins_file, 'rb') as fp:
+ exec(compile(fp.read(), plugins_file, 'exec'), globals(), {})
except:
logger.critical("Error while loading plugins from file %s"%plugins_file)
traceback.print_exc()