Skip to content
Snippets Groups Projects
Commit 60e39a05 authored by Adriano Contillo's avatar Adriano Contillo
Browse files

Ported to Python 3 (backward compatible with Python 2)

parent dc92ef3b
Branches master
Tags 2.0.0
No related merge requests found
......@@ -6,7 +6,7 @@ MODNAME = $(MAIN:.py=)
default: bin
@cp src/*.py bin/${DIRNAME}
@echo "#!/usr/bin/env python\nimport sys\nsys.path.append(sys.path[0]+'/${DIRNAME}')\nfrom ${MODNAME} import main\nif __name__ == '__main__':\n main()\n" > bin/${NAME}
@echo "#!/usr/bin/env python3\nimport sys\nsys.path.append(sys.path[0]+'/${DIRNAME}')\nfrom ${MODNAME} import main\nif __name__ == '__main__':\n main()\n" > bin/${NAME}
@chmod +x bin/${NAME} bin/${DIRNAME}/${MAIN}
bin:
......
......@@ -67,7 +67,7 @@ class BCS(PyTango.Device_4Impl):
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
#print "[Device delete_device method] for device",self.get_name()
#print ("[Device delete_device method] for device",self.get_name())
if self.connectionOk:
self.s.close()
del self.s
......@@ -77,7 +77,7 @@ class BCS(PyTango.Device_4Impl):
# Device initialization
#------------------------------------------------------------------
def init_device(self):
#print "In ", self.get_name(), "::init_device()"
#print ("In ", self.get_name(), "::init_device()")
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
self.connectionOk = False
......@@ -101,7 +101,7 @@ class BCS(PyTango.Device_4Impl):
# Read Attribute Hardware
#------------------------------------------------------------------
def read_attr_hardware(self,data):
#print "In ", self.get_name(), "::read_attr_hardware()"
#print ("In ", self.get_name(), "::read_attr_hardware()")
return
......@@ -109,7 +109,7 @@ class BCS(PyTango.Device_4Impl):
# Read Monitoring attribute
#------------------------------------------------------------------
def read_ConnectionOK(self, attr):
#print "In ", self.get_name(), "::read_Monitoring()"
#print ("In ", self.get_name(), "::read_Monitoring()")
# Add your own code here
attr.set_value(self.connectionOk)
......@@ -128,7 +128,7 @@ class BCS(PyTango.Device_4Impl):
# argin:
#------------------------------------------------------------------
def WriteRead(self, argin):
#print "In ", self.get_name(), "::Acquire()"
#print ("In ", self.get_name(), "::Acquire()")
# Add your own code here
reply = None
if not self.connectToBCS():
......@@ -141,7 +141,7 @@ class BCS(PyTango.Device_4Impl):
if not readable[0]:
PyTango.Except.throw_exception("BCS Communication error","Timeout error","WriteRead")
reply = str(self.s.recv(1024))
self.failures = 0
self.failures = 0
except:
self.failures += 1
if self.failures == 10:
......@@ -215,7 +215,7 @@ class BCS(PyTango.Device_4Impl):
bcs_full_cmd = "UES %s %d" % (self.BCS_cmds[attr.get_name()], value_in)
reply = self.WriteRead(bcs_full_cmd)
if not "OK" in reply:
self.error_stream("BCS Communication error %s" % str(reply))
self.error_stream("BCS Communication error %s" % str(reply))
PyTango.Except.throw_exception("BCS Communication error",reply,"writedUesToBCS")
#------------------------------------------------------------------
......@@ -416,7 +416,7 @@ class BCSClass(PyTango.DeviceClass):
def __init__(self, name):
PyTango.DeviceClass.__init__(self, name)
self.set_type(name);
#print "In BCSClass constructor"
#print ("In BCSClass constructor")
#==================================================================
#
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment