Salome HOME
bos #28780 EDF 24163 warnings in terminal when using salome_pluginsmanager.py
authorvsr <vsr@opencascade.com>
Thu, 27 Jan 2022 16:25:50 +0000 (19:25 +0300)
committervsr <vsr@opencascade.com>
Thu, 27 Jan 2022 16:25:50 +0000 (19:25 +0300)
src/SalomeApp/salome_pluginsmanager.py

index 8df655096da07874fc2dc3b20426f4ce0a12c12e..25276d4416e31ba2abbc778779fa1d124aa26d67 100644 (file)
@@ -281,7 +281,8 @@ class PluginsManager:
               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()