本文整理汇总了Python中OpenRTM_aist.isAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:Python OpenRTM_aist.isAbsolutePath方法的具体用法?Python OpenRTM_aist.isAbsolutePath怎么用?Python OpenRTM_aist.isAbsolutePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRTM_aist
的用法示例。
在下文中一共展示了OpenRTM_aist.isAbsolutePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import isAbsolutePath [as 别名]
def load(self, file_name, init_func=None):
if not self._rtcout:
self._rtcout = self._mgr.getLogbuf("ModuleManager")
self._rtcout.RTC_TRACE("load(fname = %s)", file_name)
if file_name == "":
raise ModuleManager.InvalidArguments, "Invalid file name."
if OpenRTM_aist.isURL(file_name):
if not self._downloadAllowed:
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"
else:
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
else:
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
if not pathChanged:
splitted_name = os.path.split(file_path)
sys.path.append(splitted_name[0])
ext_pos = import_name.find(".py")
if ext_pos > 0:
import_name = import_name[:ext_pos]
mo = __import__(str(import_name))
if pathChanged:
sys.path = save_path
dll = self.DLLEntity(mo,OpenRTM_aist.Properties())
dll.properties.setProperty("file_path",file_path)
self._modules.registerObject(dll)
if init_func is None:
return file_name
self.symbol(file_path,init_func)(self._mgr)
return file_name