当前位置: 首页>>代码示例>>Python>>正文


Python Except.throw_python_exception方法代码示例

本文整理汇总了Python中PyTango.Except.throw_python_exception方法的典型用法代码示例。如果您正苦于以下问题:Python Except.throw_python_exception方法的具体用法?Python Except.throw_python_exception怎么用?Python Except.throw_python_exception使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyTango.Except的用法示例。


在下文中一共展示了Except.throw_python_exception方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_Value

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_Value(self, attr):
     oned = self.oned
     # TODO: decide if we force the controller developers to store the
     # last acquired value in the controllers or we always will use
     # cache. This is due to the fact that the clients (MS) read the value
     # after the acquisition had finished.
     use_cache = oned.is_in_operation() and not self.Force_HW_Read
     # For the moment we just check if we recently receive ValueBuffer.
     # event. In this case, we use cache and clean the flag
     # so the cached value will be returned only at the first readout
     # after the acquisition. This is a workaround for the count executed
     # by the MacroServer e.g. step scans or ct which read the value after
     # the acquisition.
     if not use_cache and self._first_read_cache:
         use_cache = True
         self._first_read_cache = False
     value = oned.get_value(cache=use_cache, propagate=0)
     if value.error:
         Except.throw_python_exception(*value.exc_info)
     state = oned.get_state(cache=use_cache, propagate=0)
     quality = None
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     self.set_attribute(attr, value=value.value, quality=quality,
                        timestamp=value.timestamp, priority=0)
开发者ID:rhomspuron,项目名称:sardana,代码行数:27,代码来源:OneDExpChannel.py

示例2: _to_motor_write_positions

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def _to_motor_write_positions(self, pos):
     w_positions = []
     for elem in self.motor_group.get_user_elements():
         position = pos[elem]
         if position.in_error():
             Except.throw_python_exception(*position.exc_info)
         w_positions.append(position.w_value)
     return w_positions
开发者ID:rhomspuron,项目名称:sardana,代码行数:10,代码来源:MotorGroup.py

示例3: read_Value

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_Value(self, attr):
     twod = self.twod
     use_cache = twod.is_in_operation() and not self.Force_HW_Read
     value = twod.get_value(cache=use_cache, propagate=0)
     if value.error:
         Except.throw_python_exception(*value.exc_info)
     state = twod.get_state(cache=use_cache, propagate=0)
     quality = None
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     self.set_attribute(attr, value=value.value, quality=quality,
                        timestamp=value.timestamp, priority=0)
开发者ID:cmft,项目名称:sardana,代码行数:14,代码来源:TwoDExpChannel.py

示例4: read_DialPosition

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_DialPosition(self, attr):
     motor = self.motor
     use_cache = motor.is_in_operation() and not self.Force_HW_Read
     state = motor.get_state(cache=use_cache, propagate=0)
     dial_position = motor.get_dial_position(cache=use_cache, propagate=0)
     if dial_position.error:
         Except.throw_python_exception(*dial_position.exc_info)
     quality = None
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     self.set_attribute(attr, value=dial_position.value, quality=quality,
                        priority=0, timestamp=dial_position.timestamp)
开发者ID:cmft,项目名称:sardana,代码行数:14,代码来源:Motor.py

示例5: read_CurrentValue

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_CurrentValue(self, attr):
     zerod = self.zerod
     #use_cache = ct.is_action_running() and not self.Force_HW_Read
     use_cache = self.get_state() == State.Moving and not self.Force_HW_Read
     value = zerod.get_current_value(cache=use_cache, propagate=0)
     if value.error:
         Except.throw_python_exception(*value.exc_info)
     quality = None
     state = zerod.get_state(cache=use_cache, propagate=0)
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     self.set_attribute(attr, value=value.value, quality=quality,
                        priority=0, timestamp=value.timestamp)
开发者ID:rhomspuron,项目名称:sardana,代码行数:15,代码来源:ZeroDExpChannel.py

示例6: throw_sardana_exception

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
def throw_sardana_exception(exc):
    """Throws an exception as a tango exception"""
    if isinstance(exc, SardanaException):
        if exc.exc_info and not None in exc.exc_info:
            Except.throw_python_exception(*exc.exc_info)
        else:
            tb = "<Unknown>"
            if exc.traceback is not None:
                tb = str(exc.traceback)
            Except.throw_exception(exc.type, exc.msg, tb)
    elif hasattr(exc, 'exc_info'):
        Except.throw_python_exception(*exc.exc_info)
    else:
        raise exc
开发者ID:cmft,项目名称:sardana,代码行数:16,代码来源:util.py

示例7: read_Position

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_Position(self, attr):
     # if motors are moving their position is already being updated with a
     # high frequency so don't bother overloading and just get the cached
     # values
     motor_group = self.motor_group
     use_cache = motor_group.is_in_operation() and not self.Force_HW_Read
     position = motor_group.get_position(cache=use_cache, propagate=0)
     if position.error:
         Except.throw_python_exception(*position.exc_info)
     state = motor_group.get_state(cache=use_cache, propagate=0)
     quality = None
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     self.set_attribute(attr, value=position.value, w_value=position.w_value,
                        quality=quality, priority=0,
                        timestamp=position.timestamp)
开发者ID:rhomspuron,项目名称:sardana,代码行数:18,代码来源:MotorGroup.py

示例8: read_Value

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_Value(self, attr):
     pseudo_counter = self.pseudo_counter
     use_cache = pseudo_counter.is_in_operation() and not self.Force_HW_Read
     if not use_cache and self._first_read_cache:
         use_cache = True
         self._first_read_cache = False
     value_attr = pseudo_counter.get_value(cache=use_cache, propagate=0)
     # first obtain the value - during this process it may
     # enter into the error state, either when updating the elements
     # values or when calculating the pseudo value
     value = value_attr.value
     if value_attr.error:
         Except.throw_python_exception(*value_attr.exc_info)
     quality = None
     state = pseudo_counter.get_state(cache=use_cache, propagate=0)
     if state == State.Moving:
         quality = AttrQuality.ATTR_CHANGING
     timestamp = value_attr.timestamp
     self.set_attribute(attr, value=value, quality=quality,
                        priority=0, timestamp=timestamp)
开发者ID:rhomspuron,项目名称:sardana,代码行数:22,代码来源:PseudoCounter.py

示例9: read_Value

# 需要导入模块: from PyTango import Except [as 别名]
# 或者: from PyTango.Except import throw_python_exception [as 别名]
 def read_Value(self, attr):
     value = self.ior.get_value(cache=False)
     if value.error:
         Except.throw_python_exception(*value.exc_info)
     self.set_attribute(attr, value=value.value, w_value=value.w_value,
                        priority=0, timestamp=value.timestamp)
开发者ID:cmft,项目名称:sardana,代码行数:8,代码来源:IORegister.py


注:本文中的PyTango.Except.throw_python_exception方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。