def _runMacro(self, xml, **kwargs): #kwargs like 'synch' are ignored in this re-implementation if self._spock_state != RUNNING_STATE: print "Unable to run macro: No connection to door '%s'" % self.getSimpleName() raise Exception("Unable to run macro: No connection") if xml is None: xml = self.getRunningXML() kwargs['synch'] = True try: return BaseDoor._runMacro(self, xml, **kwargs) except KeyboardInterrupt: self.write('\nCtrl-C received: Stopping... ') self.block_lines = 0 self.command_inout("StopMacro") self.writeln("Done!") except PyTango.DevFailed, e: if is_non_str_seq(e.args) and \ not isinstance(e.args, (str, unicode)): reason, desc = e.args[0].reason, e.args[0].desc macro_obj = self.getRunningMacro() if reason == 'MissingParam': print "Missing parameter:", desc print macro_obj.getInfo().doc elif reason == 'WrongParam': print "Wrong parameter:", desc print macro_obj.getInfo().doc elif reason == 'UnkownParamObj': print "Unknown parameter:", desc elif reason == 'MissingEnv': print "Missing environment:", desc elif reason in ('API_CantConnectToDevice', 'API_DeviceNotExported'): self._updateState(self._old_sw_door_state, TaurusSWDevState.Shutdown, silent=True) print "Unable to run macro: No connection to door '%s'" % self.getSimpleName() else: print "Unable to run macro:", reason, desc
def _runMacro(self, xml, **kwargs): # kwargs like 'synch' are ignored in this re-implementation if self._spock_state != RUNNING_STATE: print("Unable to run macro: No connection to door '%s'" % self.getSimpleName()) raise Exception("Unable to run macro: No connection") if self.stateObj.read().rvalue == PyTango.DevState.RUNNING: print("Another macro is running. Wait until it finishes...") raise Exception("Unable to run macro: door in RUNNING state") if xml is None: xml = self.getRunningXML() kwargs['synch'] = True try: return BaseDoor._runMacro(self, xml, **kwargs) except KeyboardInterrupt: self._handle_stop() except PyTango.DevFailed as e: if is_non_str_seq(e.args) and \ not isinstance(e.args, str): reason, desc = e.args[0].reason, e.args[0].desc macro_obj = self.getRunningMacro() if reason == 'MissingParam': print("Missing parameter:", desc) print(macro_obj.getInfo().doc) elif reason == 'WrongParam': print("Wrong parameter:", desc) print(macro_obj.getInfo().doc) elif reason == 'UnkownParamObj': print("Unknown parameter:", desc) elif reason == 'MissingEnv': print("Missing environment:", desc) elif reason in ('API_CantConnectToDevice', 'API_DeviceNotExported'): self._updateState(self._old_sw_door_state, TaurusSWDevState.Shutdown, silent=True) print("Unable to run macro: No connection to door '%s'" % self.getSimpleName()) else: print("Unable to run macro:", reason, desc)