[openrtm-commit:02590] r820 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 4月 21日 (金) 19:14:22 JST


Author: miyamoto
Date: 2017-04-21 19:14:22 +0900 (Fri, 21 Apr 2017)
New Revision: 820

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
Log:
[compat,bugfix,->RELENG_1_2] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-04-21 07:33:30 UTC (rev 819)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-04-21 10:14:22 UTC (rev 820)
@@ -254,10 +254,11 @@
         raise ModuleManager.NotAllowedOperation, "Downloading module is not allowed."
       else:
         raise ModuleManager.NotFound, "Not implemented."
-
+    
     import_name = os.path.split(file_name)[-1]
     pathChanged=False
     file_path = None
+    
     if OpenRTM_aist.isAbsolutePath(file_name):
       if not self._absoluteAllowed:
         raise ModuleManager.NotAllowedOperation, "Absolute path is not allowed"
@@ -265,6 +266,7 @@
         splitted_name = os.path.split(file_name)
         save_path = sys.path[:]
         sys.path.append(splitted_name[0])
+        
         pathChanged = True
         import_name = splitted_name[-1]
         file_path = file_name
@@ -273,7 +275,7 @@
       file_path = self.findFile(file_name, self._loadPath)
       if not file_path:
         raise ModuleManager.InvalidArguments, "Invalid file name."
-
+  
     if not self.fileExist(file_path):
       raise ModuleManager.FileNotFound, file_name
 
@@ -284,6 +286,7 @@
     ext_pos = import_name.find(".py")
     if ext_pos > 0:
       import_name = import_name[:ext_pos]
+    
     mo = __import__(str(import_name))
 
     if pathChanged:
@@ -322,7 +325,9 @@
     dll = self._modules.find(file_name)
     if not dll:
       raise ModuleManager.NotFound, file_name
-    sys.modules.pop(dll.dll.__name__)
+    dll_name = dll.dll.__name__
+    if dll_name in sys.modules.keys():
+      sys.modules.pop(dll_name)
     self._modules.unregisterObject(file_name)
     return
 



openrtm-commit メーリングリストの案内