diff --git a/Blfe.py b/Blfe.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a4d7e5e3dc21b6ca3b78ead68c4feb3a5b2ea6a
--- /dev/null
+++ b/Blfe.py
@@ -0,0 +1,635 @@
+# module for creating beamline front-end config
+# class blfe incapsulates the reading and closing of beamline front-ends shuter/stoppers
+# stores also the complet configuration
+# $Author: claudio $
+#
+# $Name:  $
+#
+# $Log: blfe.py,v $
+# Revision 1.15  2021-01-11 14:46:35  claudio
+# removed 061_BSTOPPERAF
+#
+# Revision 1.14  2018-04-30 08:36:29  claudio
+# #5959 errore closing front end
+#
+# Revision 1.13  2018-04-12 08:46:16  claudio
+# mod syrmep- verificate
+#
+# Revision 1.12  2018-04-03 08:42:34  claudio
+# #5643: modifiche syrmep
+#
+# Revision 1.11  2017-02-13 09:27:36  claudio
+# revision tag
+#
+# Revision 1.10  2016-03-21 08:54:23  claudio
+# tested commands for 112f
+#
+# Revision 1.9  2016-03-10 09:05:23  claudio
+# add 112 stopper
+#
+# Revision 1.8  2015-12-22 10:34:45  claudio
+# ticket 1591
+#
+# Revision 1.7  2014-09-29 09:08:53  claudio
+# correctc CMD and VAR for microfluo shopper
+#
+# Revision 1.6  2014-09-11 11:15:23  claudio
+# corrected label
+#
+# Revision 1.5  2014-09-10 12:16:13  claudio
+# ticket 1406: LEFT_SHUTTER_VACOWAGO_20
+#
+# Revision 1.4  2013-04-08 14:19:24  claudio
+# force case in string comparison
+#
+# Revision 1.3  2009/11/13 10:01:36  claudio
+# "natural" default rpc timeout
+#
+# Revision 1.2  2008/09/30 07:53:49  claudio
+# commented out shutter/stopper under commissioning (11.2)
+#
+# Revision 1.1  2008/09/23 09:12:10  claudio
+# First import
+#
+#
+import lib_pyElettra
+
+
+class Blfe(object):
+    def __init__(self):
+        self.nread = 0
+        self.nerror = 0
+        self.nopen = 0
+        self.nclosed = 0
+        self.nunknown = 0
+        self.nentries = 0
+
+        self.bltable = []
+        # here put in the complete table of shopper/shutters/stoppers in beamline jargon
+        # format of table entry is:
+        # 'point','host','read-command_name',value,'status',set-command_name,set-parm
+        # value:0 closed, 1 open, -1 unknown, -2 read error'
+        # status: UNKNOWN,OPEN,CLOSED,ERROR
+        # value and status are dynamically changed by read operations
+
+        # 		self.bltable.append(['BACKEND_SHOPPER_VACOBECK_20_STATUS0','bacs011.blcs.elettra.trieste.it','1.0-backend',-1,'UNKNOWN','BACKEND_SHOPPER_VACOBECK_20_RMTCMD0','RMTCMD0'])
+
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-L_VACO_1_STATUS2",
+                "011f-bcs.blcs.elettra.trieste.it",
+                "1.1M TwinMic",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-L_VACO_1_RMTCMD2",
+                "VALRMTCMD2",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "012f-bcs.blcs.elettra.trieste.it",
+                "1.2 Nanospectr.",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHUTTER_VACO_1_STATUS0",
+                "012f-bcs.blcs.elettra.trieste.it",
+                "1.2 Nanospectr.",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHUTTER_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "022F_USTOPPER1F_VACO_1_STATUS1",
+                "022f-bcs.blcs.elettra.trieste.it",
+                "2.2 ESCA",
+                -1,
+                "UNKNOWN",
+                "022F_USTOPPER1F_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "022F_USHUTTER1F_VACO_1_STATUS0",
+                "022f-bcs.blcs.elettra.trieste.it",
+                "2.2 ESCA",
+                -1,
+                "UNKNOWN",
+                "022F_USHUTTER1F_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "032F_USTOPPER1F_VACO_1_STATUS1",
+                "032f-bcs.blcs.elettra.trieste.it",
+                "3.2 VUV/Spectrom.",
+                -1,
+                "UNKNOWN",
+                "032F_USTOPPER1F_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "032F_USHUTTER1F_VACO_1_STATUS0",
+                "032f-bcs.blcs.elettra.trieste.it",
+                "3.2 VUV/Spectrom.",
+                -1,
+                "UNKNOWN",
+                "032F_USHUTTER1F_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "042f-bcs.blcs.elettra.trieste.it",
+                "4.2 Circ. pol.",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHUTTER_VACO_1_STATUS0",
+                "042f-bcs.blcs.elettra.trieste.it",
+                "4.2 Circ. pol.",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHUTTER_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "XRD_STOPPER1_VACO_11_STATUS0",
+                "052f-bcs.blcs.elettra.trieste.it",
+                "5.2 XRD1",
+                -1,
+                "UNKNOWN",
+                "XRD_STOPPER1_VACO_11_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "XRD_STOPPER2_VACO_10_STATUS3",
+                "052f-bcs.blcs.elettra.trieste.it",
+                "5.2 XRD1",
+                -1,
+                "UNKNOWN",
+                "XRD_STOPPER2_VACO_10_RMTCMD3",
+                "VALRMTCMD3",
+            ]
+        )
+        self.bltable.append(
+            [
+                "XRD_STOPPER3_VACO_10_STATUS2",
+                "052f-bcs.blcs.elettra.trieste.it",
+                "5.2 XRD1",
+                -1,
+                "UNKNOWN",
+                "XRD_STOPPER3_VACO_10_RMTCMD2",
+                "VALRMTCMD2",
+            ]
+        )
+        self.bltable.append(
+            [
+                "052F_WSHUTTER1F_VACO_1_STATUS5",
+                "052f-bcs.blcs.elettra.trieste.it",
+                "5.2 SAXS",
+                -1,
+                "UNKNOWN",
+                "052F_WSHUTTER1F_VACO_1_RMTCMD5",
+                "VALRMTCMD5",
+            ]
+        )
+        self.bltable.append(
+            [
+                "052F_WSTOPPER1F_VACO_1_STATUS4",
+                "052f-bcs.blcs.elettra.trieste.it",
+                "5.2 SAXS",
+                -1,
+                "UNKNOWN",
+                "052F_WSTOPPER1F_VACO_1_RMTCMD4",
+                "VALRMTCMD4",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "061F_BSTOPPERCF_VACO_1_STATUS2",
+                "061f-bcs.blcs.elettra.trieste.it",
+                "6.1 Mat. Science",
+                -1,
+                "UNKNOWN",
+                "061F_BSTOPPERCF_VACO_1_RMTCMD2",
+                "VALRMTCMD2",
+            ]
+        )
+        self.bltable.append(
+            [
+                "061F_SHOPPER-R_VACO_2_STATUS2",
+                "061f-bcs.blcs.elettra.trieste.it",
+                "6.1 Syrmep",
+                -1,
+                "UNKNOWN",
+                "061F_SHOPPER-R_VACO_2_RMTCMD2",
+                "VALRMTCMD2",
+            ]
+        )
+        self.bltable.append(
+            [
+                "061F_BSHUTTERCF_VACO_1_STATUS0",
+                "061f-bcs.blcs.elettra.trieste.it",
+                "6.1 Mat. Science",
+                -1,
+                "UNKNOWN",
+                "061F_BSHUTTERCF_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "062F_USTOPPER1F_VACO_1_STATUS1",
+                "062f-bcs.blcs.elettra.trieste.it",
+                "6.2 GasPhase",
+                -1,
+                "UNKNOWN",
+                "062F_USTOPPER1F_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "062F_USHUTTER1F_VACO_1_STATUS0",
+                "062f-bcs.blcs.elettra.trieste.it",
+                "6.2 GasPhase",
+                -1,
+                "UNKNOWN",
+                "062F_USHUTTER1F_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-R_VACO_1_STATUS0",
+                "071f-bcs.blcs.elettra.trieste.it",
+                "7.1 MCX",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-R_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "RIGHT_SHUTTER_VACO_30_STATUS4",
+                "071f-bcs.blcs.elettra.trieste.it",
+                "7.1 MCX",
+                -1,
+                "UNKNOWN",
+                "RIGHT_SHUTTER_VACO_30_RMTCMD4",
+                "VALRMTCMD4",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "072F_USTOPPER1F_VACO_1_STATUS1",
+                "072f-bcs.blcs.elettra.trieste.it",
+                "7.2 ALOISA",
+                -1,
+                "UNKNOWN",
+                "072F_USTOPPER1F_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "072F_USHUTTER1F_VACO_1_STATUS0",
+                "072f-bcs.blcs.elettra.trieste.it",
+                "7.2 ALOISA",
+                -1,
+                "UNKNOWN",
+                "072F_USHUTTER1F_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-R_VACO_2_STATUS0",
+                "081f-bcs.blcs.elettra.trieste.it",
+                "8.1 Lilit",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-R_VACO_2_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-L_VACO_1_STATUS0",
+                "081f-bcs.blcs.elettra.trieste.it",
+                "8.1 BEAR",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-L_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "RIGHT_EXSLIT_VACO_10_STATUS4",
+                "081f-bcs.blcs.elettra.trieste.it",
+                "8.1 Lilit",
+                -1,
+                "UNKNOWN",
+                "RIGHT_EXSLIT_VACO_10_RMTCMD4",
+                "VALRMTCMD4",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "082f-bcs.blcs.elettra.trieste.it",
+                "8.2 Bach",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHUTTER_VACO_1_STATUS0",
+                "082f-bcs.blcs.elettra.trieste.it",
+                "8.2 Bach",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHUTTER_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "CENTRAL_STOPPER_VACO_20_STATUS0",
+                "091f-bcs.blcs.elettra.trieste.it",
+                "9.1 SISSI",
+                -1,
+                "UNKNOWN",
+                "CENTRAL_STOPPER_VACO_20_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "092f-bcs.blcs.elettra.trieste.it",
+                "9.2 APE",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHUTTER_VACO_1_STATUS0",
+                "092f-bcs.blcs.elettra.trieste.it",
+                "9.2 APE",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHUTTER_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-R_VACO_1_STATUS4",
+                "101f-bcs.blcs.elettra.trieste.it",
+                "10.1 DXRL",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-R_VACO_1_RMTCMD4",
+                "VALRMTCMD4",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-L_VACO_1_STATUS0",
+                "101f-bcs.blcs.elettra.trieste.it",
+                "10.1 X-Ray Fluo.",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-L_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "LEFT_SHUTTER_VACOWAGO_20_STATUS1",
+                "101f-bcs.blcs.elettra.trieste.it",
+                "10.1L X-Ray Fluo.",
+                -1,
+                "UNKNOWN",
+                "LEFT_SHUTTER_VACOWAGO_20_RMTCMD1",
+                "RMTCMD1",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "102f-bcs.blcs.elettra.trieste.it",
+                "10.2 IUVS/BaDElPh",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHUTTER_VACO_1_STATUS0",
+                "102f-bcs.blcs.elettra.trieste.it",
+                "10.2 IUVS/BaDElPh",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHUTTER_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-R_VACO_2_STATUS0",
+                "111f-bcs.blcs.elettra.trieste.it",
+                "11.1 XAFS",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-R_VACO_2_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "RIGHT_STOPPER_VACO_30_STATUS6",
+                "111f-bcs.blcs.elettra.trieste.it",
+                "11.1 XAFS",
+                -1,
+                "UNKNOWN",
+                "RIGHT_STOPPER_VACO_30_RMTCMD6",
+                "VALRMTCMD6",
+            ]
+        )
+        self.bltable.append(
+            [
+                "FRONTEND_SHOPPER-L_VACO_1_STATUS0",
+                "111f-bcs.blcs.elettra.trieste.it",
+                "11.1 WhITE",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_SHOPPER-L_VACO_1_RMTCMD0",
+                "VALRMTCMD0",
+            ]
+        )
+
+        self.bltable.append(
+            [
+                "FRONTEND_STOPPER_VACO_1_STATUS1",
+                "112f-bcs.blcs.elettra.trieste.it",
+                "11.2 XPRESS & XRD2",
+                -1,
+                "UNKNOWN",
+                "FRONTEND_STOPPER_VACO_1_RMTCMD1",
+                "VALRMTCMD1",
+            ]
+        )
+        self.bltable.append(
+            [
+                "RIGHT_SHOPPER2_VACOWAGO_30_STATUS0",
+                "112f-bcs.blcs.elettra.trieste.it",
+                "11.2 XPRESS",
+                -1,
+                "UNKNOWN",
+                "RIGHT_SHOPPER2_VACOWAGO_30_RMTCMD0",
+                "RMTCMD0",
+            ]
+        )
+        self.bltable.append(
+            [
+                "CENTRAL_STOPPER2_VACOWAGO_20_STATUS1",
+                "112f-bcs.blcs.elettra.trieste.it",
+                "11.2 XRD2",
+                -1,
+                "UNKNOWN",
+                "CENTRAL_STOPPER2_VACOWAGO_20_RMTCMD1",
+                "RMTCMD1",
+            ]
+        )
+
+        # form dictionary of hosts-controlstem objetcs
+        self.hostdict = {}
+        for entry in self.bltable:
+            self.nunknown = self.nunknown + 1
+            self.nentries = self.nentries + 1
+            if entry[1] not in self.hostdict:
+                ControlSystem = lib_pyElettra.XCS()
+                ControlSystem.open(entry[1])
+                self.hostdict[entry[1]] = ControlSystem
+                # print 'add '+entry[1]
+
+    def disconnect(self):
+        for host, contrsys in self.hostdict.items():
+            contrsys.close()
+
+    def read(self):
+        self.nread = 0
+        self.nerror = 0
+        self.nopen = 0
+        self.nclosed = 0
+        self.nunknown = 0
+        for entry in self.bltable:
+            ControlSystem = self.hostdict[entry[1]]
+            resp = ControlSystem.fetch(entry[0])
+            self.nread = self.nread + 1
+            # print (entry[0]+" "+resp[0]+" "+resp[1])
+            if resp[1] == "fetchException":
+                entry[3] = -2
+                entry[4] = "ERROR"
+                self.nerror = self.nerror + 1
+            # 				print entry[0]+' read error'
+            else:
+                if resp[0] == "1" and resp[1].lower() == "open":
+                    entry[3] = 1
+                    entry[4] = "OPEN"
+                    self.nopen = self.nopen + 1
+                # 					print entry[0]+' OPENED'
+                elif resp[0] == "0" and resp[1].lower() == "closed":
+                    entry[3] = 0
+                    entry[4] = "CLOSED"
+                    self.nclosed = self.nclosed + 1
+                # 					print entry[0]+' CLOSED'
+                elif resp[0] == "3" and resp[1].lower() == "closed":
+                    entry[3] = 0
+                    entry[4] = "CLOSED"
+                    self.nclosed = self.nclosed + 1
+                else:
+                    entry[3] = -1
+                    entry[4] = "UNKNOWN"
+
+    # 					print entry[0]+' UNKNOWN '+ resp[0]+ " "+resp[1]
+    def allclosed(self):
+        # return 1 ONLY if we are positvely sure that we have successufully read all the shutters and that they are closed
+        if self.nclosed == self.nread and self.nread == self.nentries:
+            return 1
+        else:
+            return 0
+
+    def closeall(self):
+        # send close command to all known front-ends shuttters,stoppers, etc.
+        nclosed = 0
+        nerror = 0
+        errtable = []
+        for entry in self.bltable:
+            ControlSystem = self.hostdict[entry[1]]
+            nclosed = nclosed + 1
+            # print(nclosed, entry[5], entry[6])
+            if len(entry[5]) > 0 and len(entry[6]) > 0:
+                resp = ControlSystem.doit(
+                    entry[5], entry[6], "0"
+                )  # 0 per chiudere, 1 per aprire!
+            else:
+                resp = "OK"
+            if resp.find("OK") == -1:
+                nerror = nerror + 1
+                errtable.append([entry[1], entry[2], entry[5], entry[6]])
+        if nerror:
+            return errtable
diff --git a/FRTND_E/FRTND_E.py b/FRTND_E/FRTND_E.py
index 237b843434f1263eb022528c462c585db20f723d..ff44792a49329fb6698a2524c2ea6ba82045808f 100755
--- a/FRTND_E/FRTND_E.py
+++ b/FRTND_E/FRTND_E.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 # $Author: claudio $
 #
@@ -10,15 +10,13 @@
 #
 #
 
-import sys
-from PyQt4 import QtCore, QtGui
-#from ui_frntd_e import Ui_frntd_e
 from active_frntd_e import active_frntd_e
+from PyQt4 import QtGui
+import sys
+
 app = QtGui.QApplication(sys.argv)
 window = QtGui.QDialog()
-#ui = Ui_frntd_e()
-ui=active_frntd_e()
-#ui.setupUi(window)
+ui = active_frntd_e()
 ui.setup(window)
 
 window.show()
diff --git a/FRTND_E/active_frntd_e.py b/FRTND_E/active_frntd_e.py
index 9e260e63734f9f3214b9731f82ebba9d82884c37..174a749ba118ab7a459e81d3f8aa08a876893934 100644
--- a/FRTND_E/active_frntd_e.py
+++ b/FRTND_E/active_frntd_e.py
@@ -15,31 +15,34 @@
 #
 
 
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtCore
+from PyQt4 import QtGui
 from ui_frntd_e import *
-import blfe
+import Blfe
 import tango
 
 
 class Worker(QtCore.QThread):
     def __init__(self, parent=None):
         QtCore.QThread.__init__(self, parent)
-        self.BL = blfe.blfe()
+        self.BL = Blfe.Blfe()
         self.exiting = False
-        self.mode = 'update'
+        self.mode = "update"
         # tango device for syrmep - geco device
         self.syrmepstopper = 0
         self.syrmepstopperindex = 0
         self.stopper_value = -1  # 0: closed , 1:open, -1 : unknown
         try:
-            self.syrmepstopper = tango.DeviceProxy('syrmep-control-01.blcs.elettra.trieste.it:20000/syrmep/beamline/geco')
-        except:
+            self.syrmepstopper = tango.DeviceProxy(
+                "syrmep-control-01.blcs.elettra.trieste.it:20000/syrmep/beamline/geco"
+            )
+        except tango.DevFailed as e:
             self.syrmepstopper = 0
 
     def run(self):
-        if self.mode == 'update':
+        if self.mode == "update":
             self.update()
-        if self.mode == 'execute':
+        if self.mode == "execute":
             self.execute()
 
     def update(self):
@@ -48,21 +51,29 @@ class Worker(QtCore.QThread):
         # read tango status
         try:
             self.stopper_value = self.syrmepstopper.r_bs4_v
-        except:
+        except tango.DevFailed as e:
             self.stopper_value = -1
 
     def execute(self):
         errtable = self.BL.closeall()
 
-        #close tango controlloed syrme stopper
+        # close tango controlloed syrme stopper
         try:
-            self.syrmepstopper.r_bs4_v=0
-        except:
-            self.emit(QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), self.BL, 'geco/r_bs4_v failed')
+            self.syrmepstopper.r_bs4_v = 0
+        except tango.DevFailed as e:
+            self.emit(
+                QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
+                self.BL,
+                "geco/r_bs4_v failed",
+            )
         if errtable is None:
             self.emit(QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"), self.BL)
         else:
-            self.emit(QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), self.BL, errtable)
+            self.emit(
+                QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
+                self.BL,
+                errtable,
+            )
 
 
 class active_frntd_e(Ui_frntd_e, QtCore.QObject):
@@ -80,10 +91,26 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
         # create worker thread - does all the slow network activities
         self.thread = Worker()
 
-        self.connect(self.thread, QtCore.SIGNAL("UpdateThread(PyQt_PyObject)"), self.slot_thread_update)
-        self.connect(self.thread, QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"), self.slot_thread_execute)
-        self.connect(self.thread, QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), self.slot_thread_execute_error)
-        self.connect(self.thread, QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), self.slot_thread_tango_error)
+        self.connect(
+            self.thread,
+            QtCore.SIGNAL("UpdateThread(PyQt_PyObject)"),
+            self.slot_thread_update,
+        )
+        self.connect(
+            self.thread,
+            QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"),
+            self.slot_thread_execute,
+        )
+        self.connect(
+            self.thread,
+            QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
+            self.slot_thread_execute_error,
+        )
+        self.connect(
+            self.thread,
+            QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
+            self.slot_thread_tango_error,
+        )
 
         # get reference of BL object from thread
         # since the class only reads form BL object non synch primitives are used
@@ -112,9 +139,9 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
             self.tableWidget.setRowHeight(row, 22)
             row = row + 1
         # add Tango managed entries - different
-        bname = 'Syrmep'
-        objname = 'geco/r_bs4_v'
-        stname = 'UNKNOWN'
+        bname = "Syrmep"
+        objname = "geco/r_bs4_v"
+        stname = "UNKNOWN"
         col0 = QtGui.QTableWidgetItem(bname, 0)
         col1 = QtGui.QTableWidgetItem(objname, 1)
         col2 = QtGui.QTableWidgetItem(stname, 2)
@@ -130,7 +157,7 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
         palette.setBrush(QtGui.QPalette.Window, self.graybrush)
         self.label.setPalette(palette)
         self.label.setAutoFillBackground(1)
-        self.label.setText('UNKNOWN')
+        self.label.setText("UNKNOWN")
 
         # resize columns
         self.tableWidget.setColumnWidth(0, 130)
@@ -147,23 +174,23 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
 
     def update_table(self):
         # configure and start thread
-        self.thread.mode = 'update'
+        self.thread.mode = "update"
         self.thread.start()
 
-    def redraw_table(self, myBL):
+    def redraw_table(self, mybl):
         # redraw  informations
         row = 0
-        for entry in myBL.bltable:
+        for entry in mybl.bltable:
             stname = entry[4]
             item = self.tableWidget.item(row, 2)
             item.setText(stname)
-            if stname == 'OPEN':
+            if stname == "OPEN":
                 item.setBackground(self.redbrush)
-            if stname == 'CLOSED':
+            if stname == "CLOSED":
                 item.setBackground(self.greenbrush)
-            if stname == 'ERROR':
+            if stname == "ERROR":
                 item.setBackground(self.yellowbrush)
-            if stname == 'UNKNOWN':
+            if stname == "UNKNOWN":
                 item.setBackground(self.graybrush)
             # self.tableWidget.setItem(row,2,item)
             row = row + 1
@@ -172,20 +199,20 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
         item = self.tableWidget.item(idx, 2)
         if self.thread.stopper_value == 1:
             item.setBackground(self.redbrush)
-            item.setText('OPEN')
+            item.setText("OPEN")
         if self.thread.stopper_value == 0:
             item.setBackground(self.greenbrush)
-            item.setText('CLOSED')
+            item.setText("CLOSED")
         if self.thread.stopper_value == -1:
             item.setBackground(self.graybrush)
-            item.setText('UNKNOWN')
+            item.setText("UNKNOWN")
         palette = self.label.palette()
-        if (myBL.allclosed() == 1 and self.thread.stopper_value == 0):
+        if mybl.allclosed() == 1 and self.thread.stopper_value == 0:
             palette.setBrush(QtGui.QPalette.Window, self.greenbrush)
-            self.label.setText('ALL CLOSED')
+            self.label.setText("ALL CLOSED")
         else:
             palette.setBrush(QtGui.QPalette.Window, self.redbrush)
-            self.label.setText('OPEN/CLOSED')
+            self.label.setText("OPEN/CLOSED")
         self.label.setPalette(palette)
         self.label.setAutoFillBackground(1)
 
@@ -195,50 +222,55 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
         self.thread.wait()
 
         # start execution thread
-        self.thread.mode = 'execute'
+        self.thread.mode = "execute"
         self.thread.start()
 
         # post dialog box since there is some time to wait
         if self.msgbox is None:
-            self.msgbox = QtGui.QProgressDialog('Closing front-ends...', '', 0, 0)
-            self.msgbox.setLabelText('Closing front-ends...')
-            self.msgbox.setCancelButtonText('')
-            self.msgbox.setWindowTitle('BEAMLINE FRONT END')
+            self.msgbox = QtGui.QProgressDialog("Closing front-ends...", "", 0, 0)
+            self.msgbox.setLabelText("Closing front-ends...")
+            self.msgbox.setCancelButtonText("")
+            self.msgbox.setWindowTitle("BEAMLINE FRONT END")
             self.msgbox.setModal(True)
             # How do you remove a button in a dialog????
             # butt=self.msgbox.button(QtGui.QMessageBox.Close)
             # as a work-aroud, remove cancel functionality
-            QtCore.QObject.disconnect(self.msgbox, QtCore.SIGNAL('canceled()'), self.msgbox, QtCore.SLOT('cancel()'))
+            QtCore.QObject.disconnect(
+                self.msgbox,
+                QtCore.SIGNAL("canceled()"),
+                self.msgbox,
+                QtCore.SLOT("cancel()"),
+            )
             self.msgbox.show()
             QtCore.SIGNAL
         else:
             self.msgbox.show()
 
-    def slot_thread_update(self, myBL):
+    def slot_thread_update(self, mybl):
         # slot called when read is terminated
-        self.redraw_table(myBL)
+        self.redraw_table(mybl)
 
-    def slot_thread_execute(self, myBL):
+    def slot_thread_execute(self, mybl):
         # called when execution thread is terminated normally
         self.msgbox.close()
-        self.redraw_table(myBL)
+        self.redraw_table(mybl)
         self.timer.start(3000)
 
-    def slot_thread_execute_error(self, myBL, myerrtable):
+    def slot_thread_execute_error(self, mybl, myerrtable):
         # called when execution thread is terminated with error
         self.msgbox.close()
-        self.redraw_table(myBL)
+        self.redraw_table(mybl)
         self.timer.start(3000)
         # shuold improve formatting of beamline errors...
-        QtGui.QMessageBox.critical(self.ui, 'front-end close', repr(myerrtable))
+        QtGui.QMessageBox.critical(self.ui, "front-end close", repr(myerrtable))
 
-    def slot_thread_tango_error(self, myBL, msg):
+    def slot_thread_tango_error(self, mybl, msg):
         # called when execution thread is terminated with error
         self.msgbox.close()
-        self.redraw_table(myBL)
+        self.redraw_table(mybl)
         self.timer.start(3000)
         # shuold improve formatting of beamline errors...
-        QtGui.QMessageBox.critical(self.ui, 'syrmep front-end close', msg)
+        QtGui.QMessageBox.critical(self.ui, "syrmep front-end close", repr(msg))
 
     def slot_quit(self):
         self.timer.stop()
diff --git a/FRTND_E/ui_frntd_e.py b/FRTND_E/ui_frntd_e.py
index 3602c35d658e48320202ec7fe50244d7d62d30fb..c660815c4e4e1bcfc634afccc8815167f919d4e3 100644
--- a/FRTND_E/ui_frntd_e.py
+++ b/FRTND_E/ui_frntd_e.py
@@ -11,17 +11,24 @@ from PyQt4 import QtCore, QtGui
 try:
     _fromUtf8 = QtCore.QString.fromUtf8
 except AttributeError:
+
     def _fromUtf8(s):
         return s
 
+
 try:
     _encoding = QtGui.QApplication.UnicodeUTF8
+
     def _translate(context, text, disambig):
         return QtGui.QApplication.translate(context, text, disambig, _encoding)
+
+
 except AttributeError:
+
     def _translate(context, text, disambig):
         return QtGui.QApplication.translate(context, text, disambig)
 
+
 class Ui_frntd_e(object):
     def setupUi(self, frntd_e):
         frntd_e.setObjectName(_fromUtf8("frntd_e"))
@@ -56,7 +63,9 @@ class Ui_frntd_e(object):
         self.pushClose.setFont(font)
         self.pushClose.setObjectName(_fromUtf8("pushClose"))
         self.vboxlayout.addWidget(self.pushClose)
-        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+        spacerItem = QtGui.QSpacerItem(
+            20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding
+        )
         self.vboxlayout.addItem(spacerItem)
         self.hboxlayout.addLayout(self.vboxlayout)
         self.tableWidget = QtGui.QTableWidget(frntd_e)
@@ -102,4 +111,3 @@ class Ui_frntd_e(object):
         item.setText(_translate("frntd_e", "Point Name", None))
         item = self.tableWidget.horizontalHeaderItem(2)
         item.setText(_translate("frntd_e", "Status", None))
-
diff --git a/TCPSserver/TCPS2tango.coverage b/TCPSserver/TCPS2tango.coverage
deleted file mode 100644
index 6be62e646ae741c1f75f2a69a24eb48b40ea61f7..0000000000000000000000000000000000000000
Binary files a/TCPSserver/TCPS2tango.coverage and /dev/null differ
diff --git a/TCPSserver/TCPS2tango.py b/TCPSserver/TCPS2tango.py
index 4d3ad64c40ebdec4dd4d64f6319f506a61197233..23f2a0e0bcd7bb6d379aff2d24a349585236861f 100644
--- a/TCPSserver/TCPS2tango.py
+++ b/TCPSserver/TCPS2tango.py
@@ -2,86 +2,121 @@
 # and exec tabled actions
 
 
-import string
-import sys
-import PyTango
+# import string
+import tango
 
-#module wide constants
-okmsg = 'Command execution OK'
-errmsg_header = '*** ERROR'
+# module wide constants
+okmsg = "Command execution OK"
+errmsg_header = "*** ERROR"
 term = "\r\n"
 
 
 #################################################################################################
-#utilities - taken from tangoclient.py to prpperly convert/assign types to command and attributes
-#from strings
-
-def convertToAttributeValue(pars,  info, logger):
-    logger.debug( 'ConvertToAttribute() entering...')
-    #val = PyTango.AttributeValue()
-    #val.name = info.name
-    logger.debug( 'ConvertToAttribute() entered...')
-    if info.data_format == PyTango.SCALAR:
-        if info.data_type ==  PyTango.DevBoolean:
-            if pars[0] == '0' or pars[0].lower() == 'false':
+# utilities - taken from tangoclient.py to prpperly convert/assign types to command and attributes
+# from strings
+
+
+def convertToAttributeValue(pars, info, logger):
+    logger.debug("ConvertToAttribute() entering...")
+    # val = tango.AttributeValue()
+    # val.name = info.name
+    logger.debug("ConvertToAttribute() entered...")
+    if info.data_format == tango.SCALAR:
+        if info.data_type == tango.DevBoolean:
+            if pars[0] == "0" or pars[0].lower() == "false":
                 value = False
             else:
                 value = True
-        elif info.data_type == PyTango.DevFloat or info.data_type == PyTango.DevDouble:
+        elif info.data_type == tango.DevFloat or info.data_type == tango.DevDouble:
             value = float(pars[0])
-        elif info.data_type == PyTango.ConstDevString or info.data_type == PyTango.DevString or info.data_type == PyTango.DevUChar:
+        elif (
+            info.data_type == tango.ConstDevString
+            or info.data_type == tango.DevString
+            or info.data_type == tango.DevUChar
+        ):
             value = pars[0]
-        elif info.data_type == PyTango.DevLong or info.data_type == PyTango.DevShort or info.data_type == PyTango.DevULong or info.data_type == PyTango.DevUShort:
+        elif (
+            info.data_type == tango.DevLong
+            or info.data_type == tango.DevShort
+            or info.data_type == tango.DevULong
+            or info.data_type == tango.DevUShort
+        ):
             value = int(pars[0])
-    elif info.data_format == PyTango.SPECTRUM:
+    elif info.data_format == tango.SPECTRUM:
         temp = list()
-        if info.data_type ==  PyTango.DevBoolean:
+        if info.data_type == tango.DevBoolean:
             for p in pars:
-                if p == '0' or p.lower() == 'false':
+                if p == "0" or p.lower() == "false":
                     temp.append(False)
                 else:
                     temp.append(True)
-        elif info.data_type == PyTango.DevFloat or info.data_type == PyTango.DevDouble:
+        elif info.data_type == tango.DevFloat or info.data_type == tango.DevDouble:
             for p in pars:
                 temp.append(float(p))
-        elif info.data_type == PyTango.ConstDevString or info.data_type == PyTango.DevString or info.data_type == PyTango.DevUChar:
+        elif (
+            info.data_type == tango.ConstDevString
+            or info.data_type == tango.DevString
+            or info.data_type == tango.DevUChar
+        ):
             temp = pars
-        elif info.data_type == PyTango.DevLong or info.data_type == PyTango.DevShort or info.data_type == PyTango.DevULong or info.data_type == PyTango.DevUShort:
-            temp.append(int(p))
+        elif (
+            info.data_type == tango.DevLong
+            or info.data_type == tango.DevShort
+            or info.data_type == tango.DevULong
+            or info.data_type == tango.DevUShort
+        ):
+            for p in pars:
+                temp.append(int(p))
         value = temp
     return value
 
-####---------------------------------------------------------------------------------------------
+
+# ---------------------------------------------------------------------------------------------
+
 
 def convertToCommandInput(pars, mtype):
-    if mtype == PyTango.DevBoolean:
-        if pars[0] == '0' or pars[0].lower() == 'false':
+    if mtype == tango.DevBoolean:
+        if pars[0] == "0" or pars[0].lower() == "false":
             return False
         else:
             return True
-    elif mtype == PyTango.DevFloat or mtype == PyTango.DevDouble:
+    elif mtype == tango.DevFloat or mtype == tango.DevDouble:
         return float(pars[0])
-    elif mtype == PyTango.ConstDevString or mtype == PyTango.DevString or mtype == PyTango.DevUChar:
+    elif (
+        mtype == tango.ConstDevString
+        or mtype == tango.DevString
+        or mtype == tango.DevUChar
+    ):
         return pars[0]
-    elif mtype == PyTango.DevLong or mtype == PyTango.DevShort or mtype == PyTango.DevULong or mtype == PyTango.DevUShort:
+    elif (
+        mtype == tango.DevLong
+        or mtype == tango.DevShort
+        or mtype == tango.DevULong
+        or mtype == tango.DevUShort
+    ):
         return int(pars[0])
 
-    if mtype == PyTango.DevVarBooleanArray:
+    if mtype == tango.DevVarBooleanArray:
         temp = list()
         for p in pars:
-            if p == '0' or p.lower() == 'false':
+            if p == "0" or p.lower() == "false":
                 temp.append(False)
             else:
                 temp.append(True)
         return temp
-    elif mtype == PyTango.DevVarFloatArray or mtype == PyTango.DevVarDoubleArray:
+    elif mtype == tango.DevVarFloatArray or mtype == tango.DevVarDoubleArray:
         temp = list()
         for p in pars:
             temp.append(float(p))
         return temp
-    elif mtype == PyTango.DevVarStringArray:
+    elif mtype == tango.DevVarStringArray:
         return pars
-    elif mtype == PyTango.DevVarLongArray or mtype == PyTango.DevVarShortArray or mtype == PyTango.DevVarULongArray or mtype == PyTango.DevVarUShortArray:
+    elif (
+        mtype == tango.DevVarLongArray
+        or mtype == tango.DevVarShortArray
+        or mtype == tango.DevVarULongArray
+        or mtype == tango.DevVarUShortArray
+    ):
         temp = list()
         for p in pars:
             temp.append(int(p))
@@ -92,6 +127,7 @@ def convertToCommandInput(pars, mtype):
 
 #################################################################################################
 
+
 class ProxyContainer(object):
 
     """
@@ -101,290 +137,426 @@ class ProxyContainer(object):
     :version:
     :author:
     """
+
     def __init__(self):
-        #init to empty dictionaries the two main dispatch tables
+        # init to empty dictionaries the two main dispatch tables
         self.get_dict = {}
         self.set_dict = {}
+
     def add_logger(self, addedlogger):
         self.logger = addedlogger
+
     def parse_conf_file(self, fname):
         """
 
-        @param string fname : 
+        @param string fname :
         @return  :
         @author
         """
-        self.logger.debug('ProxyContainer.parse_conf_file() parsing: '+fname)
+        self.logger.debug("ProxyContainer.parse_conf_file() parsing: " + fname)
         try:
-            conf_file = open(fname,'r')
-        except:
-            self.logger.fatal( 'ProxyContainer.parse_conf_file() fatal error opening conf_file: '+fname)
-            raise #impossible to continue....
+            conf_file = open(fname, "r")
+        except Exception:
+            self.logger.fatal(
+                "ProxyContainer.parse_conf_file() fatal error opening conf_file: "
+                + fname
+            )
+            raise  # impossible to continue....
         count = 0
         result = True
         for rawline in conf_file.readlines():
             if not rawline.strip():
-                continue  #discard empty lines
-            count = count+1
-            line=' '.join(rawline.split()) # collapse multiple white spaces into single white space
-            if(line[0]=='#' or line[0]=='*' or not line.strip()) : #discard comment and empyt lines
+                continue  # discard empty lines
+            count = count + 1
+            line = " ".join(
+                rawline.split()
+            )  # collapse multiple white spaces into single white space
+            if (
+                line[0] == "#" or line[0] == "*" or not line.strip()
+            ):  # discard comment and empyt lines
                 continue
-            datum=string.split(line,' ')
-            if (datum[0]!='GET' and datum[0] !='SET'):
+            datum = line.split(" ")
+            if datum[0] != "GET" and datum[0] != "SET":
                 result = False
-                self.logger.error( 'ProxyContainer: parse_conf_file error on line '+repr(count) +' '+ datum[0])
+                self.logger.error(
+                    "ProxyContainer: parse_conf_file error on line "
+                    + repr(count)
+                    + " "
+                    + datum[0]
+                )
                 return result
-            if(datum[0]=='GET'):
+            if datum[0] == "GET":
                 if datum[1] not in self.get_dict:
                     tangostring = datum[-1]
-                    if tangostring.count('->') ==1:
-                        px = ProxyCommand(tangostring.strip(),self.logger)
-                    elif  tangostring.count('/') >=3:
-                        px = ProxyAttribute(tangostring.strip(),self.logger)
+                    if tangostring.count("->") == 1:
+                        px = ProxyCommand(tangostring.strip(), self.logger)
+                    elif tangostring.count("/") >= 3:
+                        px = ProxyAttribute(tangostring.strip(), self.logger)
                     self.get_dict[datum[1]] = px
                 else:
-                    result=False
-                    self.logger.error( 'ProxyContainer: parse_conf_file error on line '+repr(count)+' : SET duplicate '+datum[1])
+                    result = False
+                    self.logger.error(
+                        "ProxyContainer: parse_conf_file error on line "
+                        + repr(count)
+                        + " : SET duplicate "
+                        + datum[1]
+                    )
                     return result
 
-            if(datum[0]=='SET'):
-                #create special keys for searching - must include also list of parameter names
+            if datum[0] == "SET":
+                # create special keys for searching - must include also list of parameter names
                 skey = datum[1]
                 for s in datum[2:-1]:
-                    skey = skey+'_'+s
+                    skey = skey + "_" + s
                 if skey not in self.set_dict:
                     tangostring = datum[-1]
-                    if tangostring.count('->') ==1:
-                        px = ProxyCommand(tangostring.strip(),self.logger)
-                    elif  tangostring.count('/') >=3:
-                        self.logger.debug('Inserting SET attribute '+tangostring.strip()+' with key: '+skey)
-                        px = ProxyAttribute(tangostring.strip(),self.logger)
+                    if tangostring.count("->") == 1:
+                        px = ProxyCommand(tangostring.strip(), self.logger)
+                    elif tangostring.count("/") >= 3:
+                        self.logger.debug(
+                            "Inserting SET attribute "
+                            + tangostring.strip()
+                            + " with key: "
+                            + skey
+                        )
+                        px = ProxyAttribute(tangostring.strip(), self.logger)
                     self.set_dict[skey] = px
                 else:
-                    result=False
-                    self.logger.error( 'ProxyContainer: parse_conf_file error on line '+repr(count)+' : SET duplicate '+repr(datum))
+                    result = False
+                    self.logger.error(
+                        "ProxyContainer: parse_conf_file error on line "
+                        + repr(count)
+                        + " : SET duplicate "
+                        + repr(datum)
+                    )
                     return result
 
         return result
 
-
     def dispatch_call(self, data):
         """
          use "data" for finding the appropriate TCPSproxy, then invoches the appropriate
          operation to it.
 
-        @param string data : 
+        @param string data :
         @return string :
         @author
         """
-        #print 'ProxyContainer: dispacth_call '+data
-        self.logger.debug('processing '+data)
+        # print 'ProxyContainer: dispacth_call '+data
+        self.logger.debug("processing " + data)
         try:
-            cleandata=' '.join(data.split()) # collapse multiple white spaces into single white space
-            selector=string.split(cleandata," ")
-            self.logger.debug('processing selector ' +selector[0])
-        except:
-            self.logger.error('message not correctly configured:'+data)
-            return errmsg_header + ' message not correctly configured'+term
+            cleandata = " ".join(
+                data.split()
+            )  # collapse multiple white spaces into single white space
+            selector = cleandata.split(" ")
+            self.logger.debug("processing selector " + selector[0])
+        except Exception:
+            self.logger.error("message not correctly configured:" + data)
+            return errmsg_header + " message not correctly configured" + term
         try:
-            if selector[0]=='GET':
-                if self.get_dict.has_key(selector[1]):
-                    handler=self.get_dict[selector[1]]
-                    resp=handler.get()
-                    if(resp==None):
-                        self.logger.error('not correctly handled: '+data)
-                        return errmsg_header +' not correctly handled'+term
+            if selector[0] == "GET":
+                if selector[1] in self.get_dict:
+                    handler = self.get_dict[selector[1]]
+                    resp = handler.get()
+                    if resp is None:
+                        self.logger.error("not correctly handled: " + data)
+                        return errmsg_header + " not correctly handled" + term
                     return resp
                 else:
-                    self.logger.error(selector[1] + ' is not configured as GET point')
-                    return  errmsg_header + ' ' +selector[1]+' is not configured as GET point'+term
+                    self.logger.error(selector[1] + " is not configured as GET point")
+                    return (
+                        errmsg_header
+                        + " "
+                        + selector[1]
+                        + " is not configured as GET point"
+                        + term
+                    )
 
-            elif selector[0]=='SET':
-                self.logger.debug('processing SET...selector : '+selector[1])
-                skey=selector[1]
-                valuelist=[]
+            elif selector[0] == "SET":
+                self.logger.debug("processing SET...selector : " + selector[1])
+                skey = selector[1]
+                valuelist = []
                 for s in selector[2:]:
-                    arg=s.split(',')
-                cmd=arg[0]
+                    arg = s.split(",")
+                cmd = arg[0]
                 for v in arg[1:]:
                     valuelist.append(v)
-                    self.logger.debug('processing SET..adding to valuelist: '+v)
-                skey=skey+'_'+cmd
-                self.logger.debug('processing SET...searching for '+skey)
-                if self.set_dict.has_key(skey):
-                    handler=self.set_dict[skey]
-                    if (handler==None):
-                        self.logger.error('SET: handler not found for: '+skey)
-                    self.logger.debug('processing SET...calling set() for device... ')
-                    resp=handler.set(valuelist)
-                    self.logger.debug('processing SET..set() called or device... ')
-                    if(resp==None):
-                        self.logger.error('not correctly handled: '+data)
-                        return errmsg_header + ' not correctly handled'+term
+                    self.logger.debug("processing SET..adding to valuelist: " + v)
+                skey = skey + "_" + cmd
+                self.logger.debug("processing SET...searching for " + skey)
+                if skey in self.set_dict:
+                    handler = self.set_dict[skey]
+                    if handler is None:
+                        self.logger.error("SET: handler not found for: " + skey)
+                    self.logger.debug("processing SET...calling set() for device... ")
+                    resp = handler.set(valuelist)
+                    self.logger.debug("processing SET..set() called or device... ")
+                    if resp is None:
+                        self.logger.error("not correctly handled: " + data)
+                        return errmsg_header + " not correctly handled" + term
                     return resp
                 else:
-                    self.logger.debug(selector[1] + ' is not configured as SET point')
-                    return  errmsg_header +' '+selector[1] +' is  not configured as SET point'+term
+                    self.logger.debug(selector[1] + " is not configured as SET point")
+                    return (
+                        errmsg_header
+                        + " "
+                        + selector[1]
+                        + " is  not configured as SET point"
+                        + term
+                    )
             # first field is neither SET nor GET... error!
-            self.logger.error('not correctly configured: '+data)
-            return errmsg_header +' not correctly configured'+term
-        except:
-            self.logger.error('exception processing data:' + data)
+            self.logger.error("not correctly configured: " + data)
+            return errmsg_header + " not correctly configured" + term
+        except Exception as e:
+            self.logger.error("exception processing data:" + data)
+
 
 ##########################################################################################
 # 'abstract' class for Proxy Objects
 class Proxy(object):
     def get(self):
         pass
-    def set(self,data):
+
+    def set(self, data):
         pass
+
+
 ##########################################################################################
 class ProxyAttribute(Proxy):
     def __init__(self, attrname, log):
-        pos=attrname.rfind('/')
-        self.__attribute=attrname[(pos+1):].strip() #get read of terminating chrartcers if left
-        self.__devname=attrname[:pos]
-        self.__attrinfo=0
-        self.logger=log
+        pos = attrname.rfind("/")
+        self.__attribute = attrname[
+            (pos + 1):
+        ].strip()  # get read of terminating chrartcers if left
+        self.__devname = attrname[:pos]
+        self.__attrinfo = 0
+        self.logger = log
         try:
-            self.__device=PyTango.DeviceProxy(self.__devname)
-            #self.__attrinfo=self.__device.get_attribute_config(self.__attribute)
-        except:
-            self.logger.error( 'ProxyAttribute.init(): failed to create '+self.__devname+' for: '+attrname)
+            self.__device = tango.DeviceProxy(self.__devname)
+            # self.__attrinfo=self.__device.get_attribute_config(self.__attribute)
+        except Exception:
+            self.logger.error(
+                "ProxyAttribute.init(): failed to create "
+                + self.__devname
+                + " for: "
+                + attrname
+            )
             return None
         try:
-            self.__attrinfo=self.__device.get_attribute_config(self.__attribute)
-        except:
-            self.__attrinfo=0
-            self.logger.error( 'ProxyAttribute.init(): failed to create self.__attrinfo for: '+self.__devname+'/'+self.__attribute)
+            self.__attrinfo = self.__device.get_attribute_config(self.__attribute)
+        except Exception:
+            self.__attrinfo = 0
+            self.logger.error(
+                "ProxyAttribute.init(): failed to create self.__attrinfo for: "
+                + self.__devname
+                + "/"
+                + self.__attribute
+            )
             return None
-        self.logger.debug('ProxyAttribute init() OK: '+self.__devname+'/'+self.__attribute)
+        self.logger.debug(
+            "ProxyAttribute init() OK: " + self.__devname + "/" + self.__attribute
+        )
 
     def get(self):
-        error=False
-        if self.__attrinfo==0:
+        error = False
+        if self.__attrinfo == 0:
             try:
-                self.logger.debug( 'ProxyAttribute.get(): getting attr config for : '+self.__devname+'/'+self.__attribute)
-                self.__attrinfo=self.__device.get_attribute_config(self.__attribute)
-            except:
-                self.logger.error( 'ProxyAttribute.get(): failed to create self.__attrinfo for: '+self.__devname+'/'+self.__attribute)
-                self.__attrinfo=0
-                error=True
-                #rstat='BEN-------' #simplicistic error notification !
-                #resp='R'+','+'?'+','+rstat+','+0+term
-                return 'R,?,BEN------,0'+term
+                self.logger.debug(
+                    "ProxyAttribute.get(): getting attr config for : "
+                    + self.__devname
+                    + "/"
+                    + self.__attribute
+                )
+                self.__attrinfo = self.__device.get_attribute_config(self.__attribute)
+            except Exception:
+                self.logger.error(
+                    "ProxyAttribute.get(): failed to create self.__attrinfo for: "
+                    + self.__devname
+                    + "/"
+                    + self.__attribute
+                )
+                self.__attrinfo = 0
+                error = True
+                # rstat='BEN-------' #simplicistic error notification !
+                # resp='R'+','+'?'+','+rstat+','+0+term
+                return "R,?,BEN------,0" + term
         try:
-            #self.logger.debug( 'ProxyAttribute.get(): reading : '+self.__devname)
-            attr=self.__device.read_attribute(self.__attribute) #read_attribute_as_string ????
-            val=attr.value
-            #self.logger.debug( 'ProxyAttribute.get(): reading value ok')
-        except PyTango.DevFailed,myex:
-            des0=myex[0].desc
-            self.logger.error ('GET: '+self.__devname+'/'+self.__attribute+' failed with exception '+des0)
-            #print 'ProxyAttribute: get() '+self.__attribute+' ERROR'
-            val=0
-            error=True
+            # self.logger.debug( 'ProxyAttribute.get(): reading : '+self.__devname)
+            attr = self.__device.read_attribute(
+                self.__attribute
+            )  # read_attribute_as_string ????
+            val = attr.value
+            # self.logger.debug( 'ProxyAttribute.get(): reading value ok')
+        except tango.DevFailed as myex:
+            des0 = myex[0].desc
+            self.logger.error(
+                "GET: "
+                + self.__devname
+                + "/"
+                + self.__attribute
+                + " failed with exception "
+                + des0
+            )
+            # print 'ProxyAttribute: get() '+self.__attribute+' ERROR'
+            val = 0
+            error = True
 
         # analyze result and prepare answer
-        rtype='?'
-        racq='R' #fixed
-        if self.__attrinfo.data_format == PyTango.SCALAR:
-            if self.__attrinfo.data_type ==  PyTango.DevBoolean:
-                rtype='D'
+        rtype = "?"
+        racq = "R"  # fixed
+        if self.__attrinfo.data_format == tango.SCALAR:
+            if self.__attrinfo.data_type == tango.DevBoolean:
+                rtype = "D"
                 if val:
-                    rvalue='1,'+self.__attrinfo.unit
+                    rvalue = "1," + self.__attrinfo.unit
                 else:
-                    rvalue='0,'+self.__attrinfo.unit
-            if self.__attrinfo.data_type ==  PyTango.DevDouble or self.__attrinfo.data_type ==  PyTango.DevFloat:
-                self.logger.debug( 'ProxyAttribute.get(): processing float...')
-                rtype='A'
-                rvalue=self.__attrinfo.format % val + ','+self.__attrinfo.unit
-                self.logger.debug( 'ProxyAttribute.get(): processing float:'+rvalue)
-            if self.__attrinfo.data_type == PyTango.DevLong or self.__attrinfo.data_type == PyTango.DevShort or self.__attrinfo.data_type == PyTango.DevULong or self.__attrinfo.data_type == PyTango.DevUShort:
-                rtype='I'
-                rvalue=self.__attrinfo.format % val + ','+self.__attrinfo.unit
-        if self.__attrinfo.data_type== 19: #pyTango.DevState
-            rtype='I'
-            rvalue= '%d'% int(val) + ','+self.__attrinfo.unit
-            if(error):
-                rstat='BEN-------' #simplicistic error notification !
+                    rvalue = "0," + self.__attrinfo.unit
+            if (
+                self.__attrinfo.data_type == tango.DevDouble
+                or self.__attrinfo.data_type == tango.DevFloat
+            ):
+                self.logger.debug("ProxyAttribute.get(): processing float...")
+                rtype = "A"
+                rvalue = self.__attrinfo.format % val + "," + self.__attrinfo.unit
+                self.logger.debug("ProxyAttribute.get(): processing float:" + rvalue)
+            if (
+                self.__attrinfo.data_type == tango.DevLong
+                or self.__attrinfo.data_type == tango.DevShort
+                or self.__attrinfo.data_type == tango.DevULong
+                or self.__attrinfo.data_type == tango.DevUShort
+            ):
+                rtype = "I"
+                rvalue = self.__attrinfo.format % val + "," + self.__attrinfo.unit
+        if self.__attrinfo.data_type == 19:  # tango.DevState
+            rtype = "I"
+            rvalue = "%d" % int(val) + "," + self.__attrinfo.unit
+            if error:
+                rstat = "BEN-------"  # simplicistic error notification !
             else:
-                rstat='----------'
-        elif self.__attrinfo.data_format == PyTango.SPECTRUM and self.__attrinfo.data_type ==  PyTango.DevBoolean:
+                rstat = "----------"
+        elif (
+            self.__attrinfo.data_format == tango.SPECTRUM
+            and self.__attrinfo.data_type == tango.DevBoolean
+        ):
             # special handling of bool spectrum - which are turned into bit masks or Bitmap
-            rtype='B'
-            longval=0
-            mask=0x1
+            rtype = "B"
+            longval = 0
+            mask = 0x1
             count = 0
-            #if self.__attrinfo.writable==PyTango._PyTango.AttrWriteType.READ_WRITE :
-            numbits=attr.dim_x #make sure to get ALWAY the Read values, also with READ_WRITE attributes
-            
-            if self.__devname.rfind('vlvfe') > 0: #workaround for different bitmaps of new valves. Dirty but... C.S. nov. 2016
-                numbits=3 #show only open close local bits - better solution must implelemented
+            # if self.__attrinfo.writable==tango._tango.AttrWriteType.READ_WRITE :
+            numbits = (
+                attr.dim_x
+            )  # make sure to get ALWAY the Read values, also with READ_WRITE attributes
+
+            if (
+                self.__devname.rfind("vlvfe") > 0
+            ):  # workaround for different bitmaps of new valves. Dirty but... C.S. nov. 2016
+                numbits = 3  # show only open close local bits - better solution must implelemented
 
             for p in val:
                 count = count + 1
-                if count >32 or count > numbits:
+                if count > 32 or count > numbits:
                     break
                 # stuff bits into bitmap - max 64 bits
 
                 if p:
-                    longval= longval | mask
+                    longval = longval | mask
                 mask = mask << 1
-            rvalue= '%d' % longval +','+self.__attrinfo.unit
-        if(error):
-            rstat='BEN-------' #simplicistic error notification !
+            rvalue = "%d" % longval + "," + self.__attrinfo.unit
+        if error:
+            rstat = "BEN-------"  # simplicistic error notification !
         else:
-            rstat='----------'
-        resp=racq+','+rtype+','+rstat+','+rvalue+term
-        self.logger.debug( 'ProxyAttribute.get(): about to return:'+resp)
+            rstat = "----------"
+        resp = racq + "," + rtype + "," + rstat + "," + rvalue + term
+        self.logger.debug("ProxyAttribute.get(): about to return:" + resp)
         return resp
 
-
-#------------------------------------------------------------------
-# set takes value in imput - use python list for arrays    
-    def set(self,data):
-        self.logger.debug( 'ProxyAttribute.set() entering for '+self.__devname+'/'+self.__attribute)
-        if self.__attrinfo==0:
+    # ------------------------------------------------------------------
+    # set takes value in imput - use python list for arrays
+    def set(self, data):
+        self.logger.debug(
+            "ProxyAttribute.set() entering for "
+            + self.__devname
+            + "/"
+            + self.__attribute
+        )
+        if self.__attrinfo == 0:
             try:
-                self.__attrinfo=self.__device.get_attribute_config(self.__attribute)
-            except PyTango.DevFailed,e:
-                des=e[0].desc
-                errmsg= errmsg_header+ ' in perform command : '+des
-                self.logger.error( 'ProxyAttribute.set(): failed to create self.__attrinfo for: '+self.__devname+'/'+self.__attribute)
-                self.__attrinfo=0
-                return errmsg+des+term
+                self.__attrinfo = self.__device.get_attribute_config(self.__attribute)
+            except tango.DevFailed as e:
+                des = e[0].desc
+                errmsg = errmsg_header + " in perform command : " + des
+                self.logger.error(
+                    "ProxyAttribute.set(): failed to create self.__attrinfo for: "
+                    + self.__devname
+                    + "/"
+                    + self.__attribute
+                )
+                self.__attrinfo = 0
+                return errmsg + des + term
         try:
-            #self.logger.debug( 'ProxyAttribute.set(): converting attribute for '+self.__devname+'/'+self.__attribute)
-            val=convertToAttributeValue(data,self.__attrinfo,self.logger)
-            self.logger.debug( 'ProxyAttribute.set(): for '+self.__devname+'/'+self.__devname+'/'+self.__attribute)
-            self.__device.write_attribute(self.__attrinfo,val)
-            self.logger.info( 'SET: ACCEPT'+self.__devname+'/'+self.__attribute+' '+data[0])
-            return okmsg+term
-        except PyTango.DevFailed,myex:
-            des0=myex[0].desc
-            self.logger.debug ('SET: '+self.__devname+'/'+self.__attribute+' failed with exception '+des0)
-            msg =  errmsg_header +' in perform command : '
-            self.logger.debug('msg:'+msg)
-            if des0.find('RESPINTA')>1:
-                msg =  errmsg_header + ' in access violation : '
-                self.logger.info( 'SET: REJECT '+self.__devname+'/'+self.__attribute+' '+data[0])
+            # self.logger.debug( 'ProxyAttribute.set(): converting attribute for '+self.__devname+'/'+self.__attribute)
+            val = convertToAttributeValue(data, self.__attrinfo, self.logger)
+            self.logger.debug(
+                "ProxyAttribute.set(): for "
+                + self.__devname
+                + "/"
+                + self.__devname
+                + "/"
+                + self.__attribute
+            )
+            self.__device.write_attribute(self.__attrinfo, val)
+            self.logger.info(
+                "SET: ACCEPT" + self.__devname + "/" + self.__attribute + " " + data[0]
+            )
+            return okmsg + term
+        except tango.DevFailed as myex:
+            des0 = myex[0].desc
+            self.logger.debug(
+                "SET: "
+                + self.__devname
+                + "/"
+                + self.__attribute
+                + " failed with exception "
+                + des0
+            )
+            msg = errmsg_header + " in perform command : "
+            self.logger.debug("msg:" + msg)
+            if des0.find("RESPINTA") > 1:
+                msg = errmsg_header + " in access violation : "
+                self.logger.info(
+                    "SET: REJECT "
+                    + self.__devname
+                    + "/"
+                    + self.__attribute
+                    + " "
+                    + data[0]
+                )
             else:
-                msg =  errmsg_header + ' in perform command : '
-                self.logger.info ('SET: '+self.__devname+'/'+self.__attribute+' failed with exception '+des0)
-            return msg+des0+term
+                msg = errmsg_header + " in perform command : "
+                self.logger.info(
+                    "SET: "
+                    + self.__devname
+                    + "/"
+                    + self.__attribute
+                    + " failed with exception "
+                    + des0
+                )
+            return msg + des0 + term
 
 
 ########################################################################################
 class ProxyCommand(Proxy):
-    def __init__(self,cmdname,log):
-        pos=cmdname.rfind('->')
-        self.__command=cmdname[(pos+2):].strip()
-        self.__devname=cmdname[:pos]
-        self.logger=log
+    def __init__(self, cmdname, log):
+        pos = cmdname.rfind("->")
+        self.__command = cmdname[(pos + 2):].strip()
+        self.__devname = cmdname[:pos]
+        self.logger = log
         try:
-            self.__device=PyTango.DeviceProxy(self.__devname)
-            self.type=self.__device.command_query(self.__command)
-        except:
-            self.logger.error('ProxyCommand():  failed to create '+self.__devname)
+            self.__device = tango.DeviceProxy(self.__devname)
+            self.type = self.__device.command_query(self.__command)
+        except Exception:
+            self.logger.error("ProxyCommand():  failed to create " + self.__devname)
+
+
 ########################################################################################
diff --git a/TCPSserver/TCPSserver.e4p b/TCPSserver/TCPSserver.e4p
deleted file mode 100644
index 7ec4265f45d4bf82a88ce98cecfc281c36818ae0..0000000000000000000000000000000000000000
--- a/TCPSserver/TCPSserver.e4p
+++ /dev/null
@@ -1,260 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Project SYSTEM "Project-4.6.dtd">
-<!-- eric4 project file for project TCPSserver -->
-<!-- Saved: 2012-02-24, 14:20:40 -->
-<!-- Copyright (C) 2012 ,  -->
-<Project version="4.6">
-  <Language></Language>
-  <ProgLanguage mixed="0">Python</ProgLanguage>
-  <ProjectType>Console</ProjectType>
-  <Description></Description>
-  <Version>0.1</Version>
-  <Author></Author>
-  <Email></Email>
-  <Sources>
-    <Source>TCPStwserver.py</Source>
-    <Source>TCPS2tango.py</Source>
-  </Sources>
-  <Forms>
-  </Forms>
-  <Translations>
-  </Translations>
-  <Resources>
-  </Resources>
-  <Interfaces>
-  </Interfaces>
-  <Others>
-  </Others>
-  <MainScript>TCPStwserver.py</MainScript>
-  <Vcs>
-    <VcsType>CVS</VcsType>
-    <VcsOptions>
-      <dict>
-        <key>
-          <string>add</string>
-        </key>
-        <value>
-          <list>
-            <string></string>
-          </list>
-        </value>
-        <key>
-          <string>checkout</string>
-        </key>
-        <value>
-          <list>
-            <string></string>
-          </list>
-        </value>
-        <key>
-          <string>commit</string>
-        </key>
-        <value>
-          <list>
-            <string></string>
-          </list>
-        </value>
-        <key>
-          <string>diff</string>
-        </key>
-        <value>
-          <list>
-            <string>-u3</string>
-            <string>-p</string>
-          </list>
-        </value>
-        <key>
-          <string>export</string>
-        </key>
-        <value>
-          <list>
-            <string></string>
-          </list>
-        </value>
-        <key>
-          <string>global</string>
-        </key>
-        <value>
-          <list>
-            <string>-f</string>
-            <string>-z3</string>
-          </list>
-        </value>
-        <key>
-          <string>history</string>
-        </key>
-        <value>
-          <list>
-            <string>-e</string>
-            <string>-a</string>
-          </list>
-        </value>
-        <key>
-          <string>log</string>
-        </key>
-        <value>
-          <list>
-            <string></string>
-          </list>
-        </value>
-        <key>
-          <string>remove</string>
-        </key>
-        <value>
-          <list>
-            <string>-f</string>
-          </list>
-        </value>
-        <key>
-          <string>status</string>
-        </key>
-        <value>
-          <list>
-            <string>-v</string>
-          </list>
-        </value>
-        <key>
-          <string>tag</string>
-        </key>
-        <value>
-          <list>
-            <string>-c</string>
-          </list>
-        </value>
-        <key>
-          <string>update</string>
-        </key>
-        <value>
-          <list>
-            <string>-dP</string>
-          </list>
-        </value>
-      </dict>
-    </VcsOptions>
-    <VcsOtherData>
-      <dict>
-      </dict>
-    </VcsOtherData>
-  </Vcs>
-  <FiletypeAssociations>
-    <FiletypeAssociation pattern="*.pyw" type="SOURCES" />
-    <FiletypeAssociation pattern="*.idl" type="INTERFACES" />
-    <FiletypeAssociation pattern="*.py" type="SOURCES" />
-    <FiletypeAssociation pattern="*.ptl" type="SOURCES" />
-  </FiletypeAssociations>
-  <Checkers>
-    <CheckersParams>
-      <dict>
-        <key>
-          <string>PYLINT</string>
-        </key>
-        <value>
-          <dict>
-            <key>
-              <string>dialogReport</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableBasic</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableClasses</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableDesign</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableExceptions</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableFormat</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableImports</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableMetrics</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableMiscellaneous</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableNewstyle</string>
-            </key>
-            <value>
-              <bool>False</bool>
-            </value>
-            <key>
-              <string>enableRPython</string>
-            </key>
-            <value>
-              <bool>False</bool>
-            </value>
-            <key>
-              <string>enableSimilarities</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableTypecheck</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>enableVariables</string>
-            </key>
-            <value>
-              <bool>True</bool>
-            </value>
-            <key>
-              <string>htmlReport</string>
-            </key>
-            <value>
-              <bool>False</bool>
-            </value>
-            <key>
-              <string>reportFile</string>
-            </key>
-            <value>
-              <unicode>pylint.html</unicode>
-            </value>
-            <key>
-              <string>txtReport</string>
-            </key>
-            <value>
-              <bool>False</bool>
-            </value>
-          </dict>
-        </value>
-      </dict>
-    </CheckersParams>
-  </Checkers>
-</Project>
\ No newline at end of file
diff --git a/TCPSserver/TCPStwserver.py b/TCPSserver/TCPStwserver.py
index d9368be06c4befb2958d6ff80e262a691e517ed4..f5933c82baa01bb251e42941432ff7f6c5654cb5 100755
--- a/TCPSserver/TCPStwserver.py
+++ b/TCPSserver/TCPStwserver.py
@@ -1,126 +1,154 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 #  TCPS server-bridge based on twisted
-from twisted.internet.protocol import Protocol, Factory
+from twisted.internet.protocol import Protocol
+from twisted.internet.protocol import Factory
 from twisted.internet import reactor
-import time
+
+# import time
 import sys
 import TCPS2tango
 import logging
 import logging.handlers
 
-#obsolete! must be switched to argparse
+# obsolete! must be switched to argparse
 import optparse
 
-global_logging=logging.getLogger('TCPS') 
+global_logging = logging.getLogger("TCPS")
 # there should be a cleaner  way ... but now I use a GLOBAL.....
-#--------------------------------------------------------------
+# --------------------------------------------------------------
+
 
 class twistedTCPS(Protocol):
-    'adapter of TCPS protocol for twisted package'
+    "adapter of TCPS protocol for twisted package"
+
     def __init__(self):
-        self.__myname='default TCPS server'
+        self.__myname = "default TCPS server"
+
     def connectionMade(self):
-        if(self.factory._timeout):
-            self.transport.socket.settimeout(self.factory._timeout) # it is possible to set timeouts!!
-        self.__peer=self.transport.getPeer()
-        global_logging.info ('new connection: ' + self.__peer.host + ':' + repr(self.__peer.port))
+        if self.factory._timeout:
+            self.transport.socket.settimeout(
+                self.factory._timeout
+            )  # it is possible to set timeouts!!
+        self.__peer = self.transport.getPeer()
+        global_logging.info(
+            "new connection: " + self.__peer.host + ":" + repr(self.__peer.port)
+        )
 
     def connectionLost(self, reason):
         self.transport.loseConnection()
-        global_logging.info('connection closed/lost: ' + self.__peer.host + ':' + repr(self.__peer.port))
+        global_logging.info(
+            "connection closed/lost: " + self.__peer.host + ":" + repr(self.__peer.port)
+        )
 
     def dataReceived(self, data):
+        global_logging.debug("dataReceived " + data.decode().strip())
         try:
-            resp=self.factory.handler.dispatch_call(data.strip())
-            self.transport.write(resp)
-        except:
-            global_logging.error ('exception writing data to ' + self.__peer.host + ':' + repr(self.__peer.port))
+            resp = self.factory.handler.dispatch_call(data.decode().strip())
+            self.transport.write(resp.encode())
+        except Exception:
+            global_logging.error(
+                "exception writing data to "
+                + self.__peer.host
+                + ":"
+                + repr(self.__peer.port)
+            )
+
 
 # method to associate TCPS object and other initialization data
-def makeTCPSFactory(fname,logger,timeout=None,):
-    factory=Factory()
-    factory.protocol=twistedTCPS
-    factory._fname=fname
-    factory._timeout=timeout
-    factory.handler=TCPS2tango.ProxyContainer()
+def makeTCPSFactory(
+    fname,
+    logger,
+    timeout=None,
+):
+    factory = Factory()
+    factory.protocol = twistedTCPS
+    factory._fname = fname
+    factory._timeout = timeout
+    factory.handler = TCPS2tango.ProxyContainer()
     factory.handler.add_logger(logger)
     factory.handler.parse_conf_file(fname)
-    
+
     return factory
 
-#-----------------------------------------------------------------
-#remeber to switch  use argparse for configuring cmd line options with python > 2.7
+
+# -----------------------------------------------------------------
+# remeber to switch  use argparse for configuring cmd line options with python > 2.7
+
 
 def main(argv=None):
     if argv is None:
-        argv = sys.argv # argv for initializing , etc
-
-    #parse comnd line and prepare optinal arguments
-    parser = optparse.OptionParser(description='TCPStwserver options')
-    parser.add_option('-f','--configfile',help='config_file')
-    parser.add_option('-p', '--port', help='tpc port number [20000]')
-    parser.add_option('-l','--logfile',help='log_file')
-    parser.add_option('-v','--loglevel',help='log_level [debug|info|warning|error|critical]')
-    parser.add_option('-s','--logsize',help='log_file_size')
-    parser.add_option('-V','--verbose',help='echo debug to console')
-    (options,argmy) = parser.parse_args()
+        argv = sys.argv  # argv for initializing , etc
+
+    # parse comnd line and prepare optinal arguments
+    parser = optparse.OptionParser(description="TCPStwserver options")
+    parser.add_option("-f", "--configfile", help="configuration file")
+    parser.add_option("-p", "--port", help="tpc port number [20000]")
+    parser.add_option("-l", "--logfile", help="log_file")
+    parser.add_option(
+        "-v", "--loglevel", help="log_level [debug|info|warning|error|critical]"
+    )
+    parser.add_option("-s", "--logsize", help="log_file_size")
+    parser.add_option("-V", "--verbose", help="echo debug to console")
+    (options, argmy) = parser.parse_args()
     if options.configfile:
-        fname=options.configfile
+        fname = options.configfile
     else:
-        print 'usage: '+sys.argv[0] + ' --configfile= '
+        print(("usage: " + sys.argv[0] + " --configfile= "))
         return 1
 
     if options.port:
-        tcpport=int(options.port)
+        tcpport = int(options.port)
     else:
-        tcpport=20000
+        tcpport = 20000
 
     if options.logfile:
-        lfile=options.logfile
+        lfile = options.logfile
     else:
-        lfile='/dev/null'
+        lfile = "/dev/null"
 
     if options.loglevel:
-        lev=options.loglevel
-        level=-1
-        if lev=='debug':
-            level=logging.DEBUG
-        elif lev=='info':
-            level=logging.INFO
-        elif lev=='warning':
-            level=logging.WARNING
-        elif lev=='error':
-            level=logging.ERROR
-        elif lev=='critical':
-            level=logging.CRITICAL
-        elif lev=='notset':
-            level==logging.NOTSET
+        lev = options.loglevel
+        level = -1
+        if lev == "debug":
+            level = logging.DEBUG
+        elif lev == "info":
+            level = logging.INFO
+        elif lev == "warning":
+            level = logging.WARNING
+        elif lev == "error":
+            level = logging.ERROR
+        elif lev == "critical":
+            level = logging.CRITICAL
+        elif lev == "notset":
+            level == logging.NOTSET
     else:
-        lev='notset'
-        level=logging.NOTSET
+        lev = "notset"
+        level = logging.NOTSET
 
     if options.logsize:
-        mBytes=int(options.logsize)
+        mBytes = int(options.logsize)
     else:
-        mBytes=2196608
+        mBytes = 2196608
 
     if options.verbose:
-        verbose=True
+        verbose = True
     else:
-        verbose=False
+        verbose = False
 
     # Set up a specific logger with our desired output level
     # use INFO for for tracking all SET operations
     # use ERROR and CRITICAL for errors (non-fatal and fatal)
     # use INFO and DEBUG for diagnostics
     # info is set with -V
-    #debug is set
-    logger = logging.getLogger('TCPS')
-    logger.setLevel(level) #default level is NOTSET
+    # debug is set
+    logger = logging.getLogger("TCPS")
+    logger.setLevel(level)  # default level is NOTSET
     formatter = logging.Formatter("%(asctime)s\t%(levelname)s\t%(message)s")
 
     # Add the log message handler to the logger
-    handler = logging.handlers.RotatingFileHandler(lfile, maxBytes=mBytes, backupCount=5)
+    handler = logging.handlers.RotatingFileHandler(
+        lfile, maxBytes=mBytes, backupCount=5
+    )
 
     # create and add formatter to logger
     handler.setFormatter(formatter)
@@ -132,21 +160,23 @@ def main(argv=None):
         ch.setLevel(level)
         ch.setFormatter(formatter)
         logger.addHandler(ch)
-        logger.info('debug echo to console')
+        logger.info("debug echo to console")
 
     # use special  builder to associate our data to TCPS object
     # extra arguments are:
     #    'internal name'
     #    timeout for network calls
-    logger.info('using config file '+fname)
-    factory=makeTCPSFactory(fname,logger)
+    logger.info("using config file " + fname)
+    factory = makeTCPSFactory(fname, logger)
 
-    # 20000 is the port assigned to TPCS - 30 seconds timeount
-    reactor.listenTCP(tcpport, factory,30.0)
+    # 20000 is the port assigned to TPCS - backlog que is 20
+    reactor.listenTCP(tcpport, factory, 10)
     # we can also  open on multiple ports, just make another instance another reactor object
-    #reactor.listenTCP(30000, factory,30.0)
-    logger.debug('entering loop')
+    # reactor.listenTCP(30000, factory,30.0)
+    logger.debug("entering loop")
     reactor.run()
-    logger.debug('exit loop')
+    logger.debug("exit loop")
+
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/TCPSserver/list-active.txt b/TCPSserver/list-active.txt
deleted file mode 100644
index d985964ea28298a4a4540d818e22db0a9cdd977d..0000000000000000000000000000000000000000
--- a/TCPSserver/list-active.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-1.1: PS120S01_M, PS400S11, VALVE01M SHUT01M XANGL011,XPOS011,YANGL011 YPOS011
-
-1.2 (012) P120S012, PS400S012 SHUT012 VALVE012 XANGL012,XPOS012,YANGL012 YPOS012
-
-2.2 (022) PS120S022 PS400S022 SHUT022 VALVE022 XANGL022,XPOS022,YANGL022 YPOS022
-
-3.2 (032) PS120S032 PS400S032 SHUT032 VALVE032 XANGL032,XPOS032,YANGL032 YPOS032
-
-4.2 (042) PS120S042 PS400S042 SHUT042 VALVE042 XANGL042,XPOS042,YANGL032 YPOS042
-
-5.2 (052) PS120S042 PS400S052 SHUT052 VALVE052 XANGL052,XPOS052,YANGL032 YPOS052
-
-6.1 (061) PS120S061 PS400S061 SHUT061 VALVE061 XANGL061,XPOS061,YANGL061 YPOS061
-
-6.2 (062) PS120S062 PS400S062 SHUT062 VALVE062 XANGL062,XPOS062,YANGL062 YPOS062
-
-7.1 (071) PS120S071 PS400S071 SHUT071 VALVE071 XANGL071,XPOS071,YANGL071 YPOS071
-
-7.2 (072) PS120S072 PS400S072 SHUT072 VALVE072 XANGL072,XPOS072,YANGL072 YPOS072
-
-8.1 (081) PS120S081 PS400S081 SHUT081 VALVE081 XANGL081,XPOS081,YANGL081 YPOS081
-
-8.2 (082) PS120S082 PS400S082 SHUT082 VALVE082 XANGL082,XPOS082,YANGL082 YPOS082
-
-9.1 (091) PS120S091 PS400S091 SHUT091 VALVE091 XANGL091,XPOS091,YANGL091 YPOS091
-
-9.2 (092) PS120S092 PS400S092 SHUT092 VALVE092 XANGL092,XPOS092,YANGL092 YPOS092
-
-10.1 (101) PS120S101 PS400S101 SHUT101 VALVE101 XANGL101,XPOS101,YANGL101 YPOS101
-
-10.2 (102) PS120S102 PS400S102 SHUT102 VALVE102 XANGL102,XPOS102,YANGL102 YPOS102
-
-11.1 (111) PS120S111 PS400S111 SHUT111 VALVE111 XANGL111,XPOS111,YANGL111 YPOS111
-
-11.2 (112) PS120S112 PS400S112 SHUT112 VALVE112 XANGL112,XPOS112,YANGL112 YPOS112
-
diff --git a/TCPSserver/tcpserver20012.log b/TCPSserver/tcpserver20012.log
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/TCPSserver/testexc.py b/TCPSserver/testexc.py
deleted file mode 100644
index 75a7c0a9ea03cd2d796f0c7eba279f29f9b25b4f..0000000000000000000000000000000000000000
--- a/TCPSserver/testexc.py
+++ /dev/null
@@ -1,19 +0,0 @@
-import sys
-import string
-import PyTango
-
-dev=PyTango.DeviceProxy('sr/id/id_s2.2')
-
-try:
-    dev.write_attribute('Gap',22.5)
-except PyTango.DevFailed, e:
-    #exctype ,value = sys.exc_info()[:2]
-    #print 'Exception: ' , e
-    #for err in e:
-      #print ' reason', err.reason
-      #print ' description', err.desc
-      #print ' origin', err.origin
-      #print ' severity',err.severity
-    Err0=e[0].desc
-    Err1=e[1].desc
-    print 'ERRR', Err0, Err1.split()[5],
\ No newline at end of file
diff --git a/TCPSserver/testsissi.cfg b/TCPSserver/testsissi.cfg
deleted file mode 100644
index 0cbe8cc61a37043e9fffae5a1e80178d2c1a5e27..0000000000000000000000000000000000000000
--- a/TCPSserver/testsissi.cfg
+++ /dev/null
@@ -1,30 +0,0 @@
-#configuration  file for elettra-Tango  to BCS bridge
-
-
-#main beam parameters
-GET FRONTEND_MACHINE_MACHINE_1_ACCUCURR tango://tom.ecs.elettra.trieste.it:20000/sr/diagnostics/dcct_s4/Current
-GET FRONTEND_MACHINE_MACHINE_1_EENERGY tango://tom.ecs.elettra.trieste.it:20000/sr/diagnostics/dcct_s4/Energy
-GET FRONTEND_MACHINE_MACHINE_1_LIFETIME tango://tom.ecs.elettra.trieste.it:20000/sr/diagnostics/dcct_s4/Lifetime
-
-#topup bits reading reading
-GET FRONTEND_MACHINE_MACHINE_1_TOPUSTA info/sr/1/Topupbits
-#BeamON reading
-GET FRONTEND_MACHINE_MACHINE_1_BEAMON info/sr/1/beamON
-
-#vacuum redings SIP120-SIP400
-
-GET FRONTEND_MACHINE_MACHINE_1_P120S091 tango://tom.ecs.elettra.trieste.it:20000/rpcbridge/rpc2tangobridge/sip120/SIP120_S9.2_PRES_RR
-GET FRONTEND_MACHINE_MACHINE_1_P400S091 tango://tom.ecs.elettra.trieste.it:20000/rpcbridge/rpc2tangobridge/sip400/SIP400_S9.1_PRES_RR
-
-#front-end VLVFE readings
-GET FRONTEND_MACHINE_MACHINE_1_VALVE091 tango://tom.ecs.elettra.trieste.it:20000/rpcbridge/rpc2tangobridge/vlvfe/VLVFE_S9.1_STAT_RF
-
-#front-end PHOTON SHUTTER readings
-
-GET FRONTEND_MACHINE_MACHINE_1_SHUT091 tango://tom.ecs.elettra.trieste.it:20000/sr/vacuum/phbsh_s9.1/StatRF
-
-#beam positions and angles at centre of straigth sections
-GET 091F_MACHINE_MACHINE_1_XPOS    sr/diagnostics/bpmid/X_B9
-GET 091F_MACHINE_MACHINE_1_YPOS    sr/diagnostics/bpmid/Y_B9
-GET 091F_MACHINE_MACHINE_1_XANGLE  sr/diagnostics/bpmid/XP_B9
-GET 091F_MACHINE_MACHINE_1_YANGLE  sr/diagnostics/bpmid/YP_B9
diff --git a/blfe.py b/blfe.py
deleted file mode 100644
index 0534223beae7355d1fe48ade93780d36566a8ee7..0000000000000000000000000000000000000000
--- a/blfe.py
+++ /dev/null
@@ -1,209 +0,0 @@
-# module for creating beamline front-end config
-# class blfe incapsulates the reading and closing of beamline front-ends shuter/stoppers
-# stores also the complet configuration
-# $Author: claudio $
-#
-# $Name:  $
-#
-# $Log: blfe.py,v $
-# Revision 1.15  2021-01-11 14:46:35  claudio
-# removed 061_BSTOPPERAF
-#
-# Revision 1.14  2018-04-30 08:36:29  claudio
-# #5959 errore closing front end
-#
-# Revision 1.13  2018-04-12 08:46:16  claudio
-# mod syrmep- verificate
-#
-# Revision 1.12  2018-04-03 08:42:34  claudio
-# #5643: modifiche syrmep
-#
-# Revision 1.11  2017-02-13 09:27:36  claudio
-# revision tag
-#
-# Revision 1.10  2016-03-21 08:54:23  claudio
-# tested commands for 112f
-#
-# Revision 1.9  2016-03-10 09:05:23  claudio
-# add 112 stopper
-#
-# Revision 1.8  2015-12-22 10:34:45  claudio
-# ticket 1591
-#
-# Revision 1.7  2014-09-29 09:08:53  claudio
-# correctc CMD and VAR for microfluo shopper
-#
-# Revision 1.6  2014-09-11 11:15:23  claudio
-# corrected label
-#
-# Revision 1.5  2014-09-10 12:16:13  claudio
-# ticket 1406: LEFT_SHUTTER_VACOWAGO_20
-#
-# Revision 1.4  2013-04-08 14:19:24  claudio
-# force case in string comparison
-#
-# Revision 1.3  2009/11/13 10:01:36  claudio
-# "natural" default rpc timeout
-#
-# Revision 1.2  2008/09/30 07:53:49  claudio
-# commented out shutter/stopper under commissioning (11.2)
-#
-# Revision 1.1  2008/09/23 09:12:10  claudio
-# First import
-#
-#
-import lib_pyElettra
-import string
-class blfe:
-    def __init__(self):
-        self.nread=0
-        self.nerror=0
-        self.nopen=0
-        self.nclosed=0
-        self.nunknown=0
-        self.nentries=0
-        
-        self.bltable=[]
-        #here put in the complete table of shopper/shutters/stoppers in beamline jargon
-        # format of table entry is:
-        # 'point','host','read-command_name',value,'status',set-command_name,set-parm
-        # value:0 closed, 1 open, -1 unknown, -2 read error'
-        # status: UNKNOWN,OPEN,CLOSED,ERROR
-        # value and status are dynamically changed by read operations
-        
-#		self.bltable.append(['BACKEND_SHOPPER_VACOBECK_20_STATUS0','bacs011.blcs.elettra.trieste.it','1.0-backend',-1,'UNKNOWN','BACKEND_SHOPPER_VACOBECK_20_RMTCMD0','RMTCMD0'])
-
-        self.bltable.append(['FRONTEND_SHOPPER-L_VACO_1_STATUS2','011f-bcs.blcs.elettra.trieste.it','1.1M TwinMic',-1,'UNKNOWN','FRONTEND_SHOPPER-L_VACO_1_RMTCMD2','VALRMTCMD2'])
-        
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','012f-bcs.blcs.elettra.trieste.it','1.2 Nanospectr.',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1' ])
-        self.bltable.append(['FRONTEND_SHUTTER_VACO_1_STATUS0','012f-bcs.blcs.elettra.trieste.it','1.2 Nanospectr.',-1,'UNKNOWN','FRONTEND_SHUTTER_VACO_1_RMTCMD0' , 'VALRMTCMD0' ])
-        
-        self.bltable.append(['022F_USTOPPER1F_VACO_1_STATUS1','022f-bcs.blcs.elettra.trieste.it','2.2 ESCA',-1,'UNKNOWN','022F_USTOPPER1F_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['022F_USHUTTER1F_VACO_1_STATUS0','022f-bcs.blcs.elettra.trieste.it','2.2 ESCA',-1,'UNKNOWN','022F_USHUTTER1F_VACO_1_RMTCMD0' , 'VALRMTCMD0' ])
-        
-        self.bltable.append(['032F_USTOPPER1F_VACO_1_STATUS1','032f-bcs.blcs.elettra.trieste.it','3.2 VUV/Spectrom.',-1,'UNKNOWN','032F_USTOPPER1F_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['032F_USHUTTER1F_VACO_1_STATUS0','032f-bcs.blcs.elettra.trieste.it','3.2 VUV/Spectrom.',-1,'UNKNOWN','032F_USHUTTER1F_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','042f-bcs.blcs.elettra.trieste.it','4.2 Circ. pol.',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['FRONTEND_SHUTTER_VACO_1_STATUS0','042f-bcs.blcs.elettra.trieste.it','4.2 Circ. pol.',-1,'UNKNOWN','FRONTEND_SHUTTER_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['XRD_STOPPER1_VACO_11_STATUS0','052f-bcs.blcs.elettra.trieste.it','5.2 XRD1',-1,'UNKNOWN','XRD_STOPPER1_VACO_11_RMTCMD0' , 'VALRMTCMD0'])
-        self.bltable.append(['XRD_STOPPER2_VACO_10_STATUS3','052f-bcs.blcs.elettra.trieste.it','5.2 XRD1',-1,'UNKNOWN','XRD_STOPPER2_VACO_10_RMTCMD3' , 'VALRMTCMD3'])
-        self.bltable.append(['XRD_STOPPER3_VACO_10_STATUS2','052f-bcs.blcs.elettra.trieste.it','5.2 XRD1',-1,'UNKNOWN','XRD_STOPPER3_VACO_10_RMTCMD2' , 'VALRMTCMD2' ])
-        self.bltable.append(['052F_WSHUTTER1F_VACO_1_STATUS5','052f-bcs.blcs.elettra.trieste.it','5.2 SAXS',-1,'UNKNOWN','052F_WSHUTTER1F_VACO_1_RMTCMD5' , 'VALRMTCMD5'])
-        self.bltable.append(['052F_WSTOPPER1F_VACO_1_STATUS4','052f-bcs.blcs.elettra.trieste.it','5.2 SAXS',-1,'UNKNOWN','052F_WSTOPPER1F_VACO_1_RMTCMD4' , 'VALRMTCMD4'])
-        
-        self.bltable.append(['061F_BSTOPPERCF_VACO_1_STATUS2','061f-bcs.blcs.elettra.trieste.it','6.1 Mat. Science',-1,'UNKNOWN','061F_BSTOPPERCF_VACO_1_RMTCMD2' , 'VALRMTCMD2'])
-        self.bltable.append(['061F_SHOPPER-R_VACO_2_STATUS2','061f-bcs.blcs.elettra.trieste.it','6.1 Syrmep',-1,'UNKNOWN','061F_SHOPPER-R_VACO_2_RMTCMD2' , 'VALRMTCMD2'])
-        self.bltable.append(['061F_BSHUTTERCF_VACO_1_STATUS0','061f-bcs.blcs.elettra.trieste.it','6.1 Mat. Science',-1,'UNKNOWN','061F_BSHUTTERCF_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['062F_USTOPPER1F_VACO_1_STATUS1','062f-bcs.blcs.elettra.trieste.it','6.2 GasPhase',-1,'UNKNOWN','062F_USTOPPER1F_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['062F_USHUTTER1F_VACO_1_STATUS0','062f-bcs.blcs.elettra.trieste.it','6.2 GasPhase',-1,'UNKNOWN','062F_USHUTTER1F_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_SHOPPER-R_VACO_1_STATUS0','071f-bcs.blcs.elettra.trieste.it','7.1 MCX',-1,'UNKNOWN','FRONTEND_SHOPPER-R_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        self.bltable.append(['RIGHT_SHUTTER_VACO_30_STATUS4','071f-bcs.blcs.elettra.trieste.it','7.1 MCX',-1,'UNKNOWN','RIGHT_SHUTTER_VACO_30_RMTCMD4' , 'VALRMTCMD4'])
-        
-        self.bltable.append(['072F_USTOPPER1F_VACO_1_STATUS1','072f-bcs.blcs.elettra.trieste.it','7.2 ALOISA',-1,'UNKNOWN','072F_USTOPPER1F_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['072F_USHUTTER1F_VACO_1_STATUS0','072f-bcs.blcs.elettra.trieste.it','7.2 ALOISA',-1,'UNKNOWN','072F_USHUTTER1F_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_SHOPPER-R_VACO_2_STATUS0','081f-bcs.blcs.elettra.trieste.it','8.1 Lilit',-1,'UNKNOWN','FRONTEND_SHOPPER-R_VACO_2_RMTCMD0' , 'VALRMTCMD0'])
-        self.bltable.append(['FRONTEND_SHOPPER-L_VACO_1_STATUS0','081f-bcs.blcs.elettra.trieste.it','8.1 BEAR',-1,'UNKNOWN','FRONTEND_SHOPPER-L_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        self.bltable.append(['RIGHT_EXSLIT_VACO_10_STATUS4','081f-bcs.blcs.elettra.trieste.it','8.1 Lilit',-1,'UNKNOWN','RIGHT_EXSLIT_VACO_10_RMTCMD4' , 'VALRMTCMD4'])
-        
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','082f-bcs.blcs.elettra.trieste.it','8.2 Bach',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['FRONTEND_SHUTTER_VACO_1_STATUS0','082f-bcs.blcs.elettra.trieste.it','8.2 Bach',-1,'UNKNOWN','FRONTEND_SHUTTER_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['CENTRAL_STOPPER_VACO_20_STATUS0','091f-bcs.blcs.elettra.trieste.it','9.1 SISSI',-1,'UNKNOWN','CENTRAL_STOPPER_VACO_20_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','092f-bcs.blcs.elettra.trieste.it','9.2 APE',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['FRONTEND_SHUTTER_VACO_1_STATUS0','092f-bcs.blcs.elettra.trieste.it','9.2 APE',-1,'UNKNOWN','FRONTEND_SHUTTER_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_SHOPPER-R_VACO_1_STATUS4','101f-bcs.blcs.elettra.trieste.it','10.1 DXRL',-1,'UNKNOWN','FRONTEND_SHOPPER-R_VACO_1_RMTCMD4' , 'VALRMTCMD4'])
-        self.bltable.append(['FRONTEND_SHOPPER-L_VACO_1_STATUS0','101f-bcs.blcs.elettra.trieste.it','10.1 X-Ray Fluo.',-1,'UNKNOWN','FRONTEND_SHOPPER-L_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['LEFT_SHUTTER_VACOWAGO_20_STATUS1','101f-bcs.blcs.elettra.trieste.it','10.1L X-Ray Fluo.',-1,'UNKNOWN','LEFT_SHUTTER_VACOWAGO_20_RMTCMD1' , 'RMTCMD1'])
-        
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','102f-bcs.blcs.elettra.trieste.it','10.2 IUVS/BaDElPh',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['FRONTEND_SHUTTER_VACO_1_STATUS0','102f-bcs.blcs.elettra.trieste.it','10.2 IUVS/BaDElPh',-1,'UNKNOWN','FRONTEND_SHUTTER_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-        
-        self.bltable.append(['FRONTEND_SHOPPER-R_VACO_2_STATUS0','111f-bcs.blcs.elettra.trieste.it','11.1 XAFS',-1,'UNKNOWN','FRONTEND_SHOPPER-R_VACO_2_RMTCMD0' , 'VALRMTCMD0'])
-        self.bltable.append(['RIGHT_STOPPER_VACO_30_STATUS6','111f-bcs.blcs.elettra.trieste.it','11.1 XAFS',-1,'UNKNOWN','RIGHT_STOPPER_VACO_30_RMTCMD6' , 'VALRMTCMD6'])
-        self.bltable.append(['FRONTEND_SHOPPER-L_VACO_1_STATUS0','111f-bcs.blcs.elettra.trieste.it','11.1 WhITE',-1,'UNKNOWN','FRONTEND_SHOPPER-L_VACO_1_RMTCMD0' , 'VALRMTCMD0'])
-
-        self.bltable.append(['FRONTEND_STOPPER_VACO_1_STATUS1','112f-bcs.blcs.elettra.trieste.it','11.2 XPRESS & XRD2',-1,'UNKNOWN','FRONTEND_STOPPER_VACO_1_RMTCMD1' , 'VALRMTCMD1'])
-        self.bltable.append(['RIGHT_SHOPPER2_VACOWAGO_30_STATUS0','112f-bcs.blcs.elettra.trieste.it','11.2 XPRESS',-1,'UNKNOWN','RIGHT_SHOPPER2_VACOWAGO_30_RMTCMD0' , 'RMTCMD0'])
-        self.bltable.append(['CENTRAL_STOPPER2_VACOWAGO_20_STATUS1','112f-bcs.blcs.elettra.trieste.it','11.2 XRD2',-1,'UNKNOWN','CENTRAL_STOPPER2_VACOWAGO_20_RMTCMD1' , 'RMTCMD1'])
-        
-        #form dictionary of hosts-controlstem objetcs
-        self.hostdict={}
-        for entry in self.bltable:
-            self.nunknown=self.nunknown+1
-            self.nentries=self.nentries+1
-            if entry[1] not in self.hostdict:
-                ControlSystem = lib_pyElettra.XCS()
-                ControlSystem.open(entry[1])
-                self.hostdict[entry[1]]=ControlSystem
-                #print 'add '+entry[1]
-    def disconnect(self):
-        for host,contrsys in self.hostdict.iteritems():
-            contrsys.close()
-    def read(self):
-        self.nread=0
-        self.nerror=0
-        self.nopen=0
-        self.nclosed=0
-        self.nunknown=0
-        for entry in self.bltable:
-            ControlSystem=self.hostdict[entry[1]]
-            resp = ControlSystem.fetch(entry[0])
-            self.nread=self.nread+1
-#			print entry[0]+" "+resp[0]+" "+resp[1]
-            if resp[1]=='fetchException':
-                ntry[3]=-2
-                entry[4]='ERROR'
-                self.nerror=self.nerror+1
-#				print entry[0]+' read error'
-            else:
-                if resp[0]=='1' and resp[1].lower()=='open':
-                    entry[3]=1
-                    entry[4]='OPEN'
-                    self.nopen=self.nopen+1
-#					print entry[0]+' OPENED'
-                elif resp[0]=='0' and resp[1].lower()=='closed':
-                    entry[3]=0
-                    entry[4]='CLOSED'
-                    self.nclosed=self.nclosed+1
-#					print entry[0]+' CLOSED'
-                elif resp[0]=='3' and resp[1].lower()=='closed':
-                    entry[3]=0
-                    entry[4]='CLOSED'
-                    self.nclosed=self.nclosed+1
-                else:
-                    entry[3]=-1
-                    entry[4]='UNKNOWN'
-#					print entry[0]+' UNKNOWN '+ resp[0]+ " "+resp[1]
-    def allclosed(self):
-# return 1 ONLY if we are positvely sure that we have successufully read all the shutters and that they are closed
-        if self.nclosed==self.nread and self.nread==self.nentries:
-            return 1
-        else:
-            return 0
-        
-    def closeall(self):
-# send close command to all known front-ends shuttters,stoppers, etc.
-        nclosed=0
-        nerror=0
-        errtable=[]
-        for entry in self.bltable:
-            ControlSystem=self.hostdict[entry[1]]
-            nclosed=nclosed+1
-            print nclosed , entry[5],entry[6]
-            if len(entry[5]) > 0 and len(entry[6]) >0:
-                resp=ControlSystem.doit(entry[5],entry[6],'0') # 0 per chiudere, 1 per aprire!
-            else:
-                resp = 'OK'
-            if ( string.find(resp,'OK') == -1):
-                nerror = nerror+1
-                errtable.append([entry[1],entry[2],entry[5],entry[6]])
-        if(nerror):
-            return errtable
diff --git a/blfetest.py b/blfetest.py
index c50bfdcedc40d63d1dbd6fe3509c0197aec4685a..389946e4c48172270e0b8d0e970ebc1fd593d885 100644
--- a/blfetest.py
+++ b/blfetest.py
@@ -1,11 +1,11 @@
-import blfe
+import Blfe
 
-BL=blfe.blfe()
+BL = Blfe.Blfe()
 
 BL.read()
 
-print 'BL all closed: '+repr(BL.allclosed())
+print("BL all closed: " + repr(BL.allclosed()))
 
 BL.disconnect()
 
-#print repr(BL.bltable)
\ No newline at end of file
+# print repr(BL.bltable)
diff --git a/demo.py b/demo.py
index 63feed7ad588d83e65c8286e421bfe62beec73b5..e33ef19de4b8bf183222dfd656a147266dac7e74 100755
--- a/demo.py
+++ b/demo.py
@@ -1,33 +1,33 @@
-#!/usr/bin/env python
-from lib_pyElettra import *
+#!/usr/bin/env python3
+import lib_pyElettra
 
 
-ControlSystem = XCS()
+ControlSystem = lib_pyElettra.XCS()
 ControlSystem.open("112f-bcs.blcs.elettra.trieste.it")
 
-#Let's read a pressure
-#resp = ControlSystem.fetch("FRONTEND_SHUTTER_TPG300_1_B2PRESSURE")
-#if resp[1]=='fetchException':
-	#print 'Exception' + resp[0]+","+resp[1]+","+resp[2]
-#else:
-	#value = float(resp[3])
-	#print 'response: press ' + repr(value)
+# Let's read a pressure
+# resp = ControlSystem.fetch("FRONTEND_SHUTTER_TPG300_1_B2PRESSURE")
+# if resp[1]=='fetchException':
+# print 'Exception' + resp[0]+","+resp[1]+","+resp[2]
+# else:
+# value = float(resp[3])
+# print 'response: press ' + repr(value)
 
-##Let's read a valve status
+# Let's read a valve status
 resp = ControlSystem.fetch("CENTRAL_STOPPER2_VACOWAGO_20_STATUS1")
-if resp[1]=='fetchException':
-	print 'Exception ' + resp[0]+","+resp[1]+","+resp[2]
+if resp[1] == "fetchException":
+    print("Exception " + resp[0] + "," + resp[1] + "," + resp[2])
 else:
-	print resp
-	value = int(resp[0])
-	print 'response: stat ' + repr(value)
+    print(resp)
+    value = int(resp[0])
+    print("response: stat " + repr(value))
 
 
-#Let's change a valve status
-resp = ControlSystem.doit('CENTRAL_STOPPER2_VACOWAGO_20_RMTCMD1' , 'RMTCMD1' ,0)
-if ( string.find(resp,'OK') == -1):
-	print 'doit ERROR' + resp[0]+","+resp[1]+","+resp[2]
+# Let's change a valve status
+resp = ControlSystem.doit("CENTRAL_STOPPER2_VACOWAGO_20_RMTCMD1", "RMTCMD1", 0)
+if resp.find("OK") == -1:
+    print("doit ERROR" + resp[0] + "," + resp[1] + "," + resp[2])
 else:
-	print 'response: ' + resp
+    print("response: " + resp)
 
 ControlSystem.close()
diff --git a/lib_pyElettra.py b/lib_pyElettra.py
index 5dc7a018c77fc6ecc8b8a9e8b5f6c50539846402..ee8e2e391e33920be720821ab818c46572310300 100644
--- a/lib_pyElettra.py
+++ b/lib_pyElettra.py
@@ -1,143 +1,144 @@
-# class for SET/GET client operations with TPCS protocol
-# used by Elettra beamlines
-# $Author:Roberto Borghes
-#
-# $Version:$
-#
+# class for SET/GET client operations with TPCS protocol
+# used by Elettra beamlines
+# $Author:Roberto Borghes
+#
+# $Version:$
+#
 # $Log: lib_pyElettra.py,v $
 # Revision 1.1  2008/09/23 09:12:10  claudio
 # First import
-#
-#
-import string
-from socket import *
-from threading import Lock
-import time
-import httplib
-
-class XCSException(Exception):
-	def __init__(self, value):
-		self.value = value
-	def __str__(self):
-		return `self.value`
-
-class XCS:
- 	def __init__(self, mode=None):
-		if mode == None:
-			self.mode = 'TCP'
-			self.port = 20000
-		elif mode == 'HTTP':
-			self.mode = mode
-			self.port = 80
-		else:
-			raise XCSException, 'Unsupported Mode: '+mode 
-		self.host = ""
-		self.sid = 0
-		self.mutex = Lock()
-			
-	def open(self, host, port=None):
-		self.host = host
-		if port != None:
-			self.port = port
-		if self.mode == 'TCP':
-			self.mutex.acquire()
-			try:
-				self.sid = socket(AF_INET, SOCK_STREAM)
-				self.sid.connect((self.host,self.port))
-			finally:
-				self.mutex.release()
-		elif self.mode == 'HTTP':
-			self.sid = 0
-		else:
-			raise XCSException, 'Not Implemented Yet!' 					
-	
-	def close(self):
-		if self.sid != 0:
-			self.mutex.acquire()
-			try:
-				self.sid.close()
-				self.sid = 0
-			finally:
-				self.mutex.release()
-					
-	def get(self, var):
-		if self.mode == 'TCP':
-			if string.find(var,"UES") != -1:
-				getvar = "GETUES "+var+"\r\n"
-			else:
-				getvar = "GET "+var+"\r\n"
-			self.mutex.acquire()
-			try:
-				self.sid.send(getvar)
-				retvar = self.sid.recv(256)
-			finally:
-				self.mutex.release()
-			line = string.split(retvar,"\r")
-			if string.find(line[0],"*** ERROR") != -1:
-				raise XCSException, line[0]
-			res = string.split(line[0],",")
-			if string.find(var,"UES") != -1:
-				return(res[0],'',res[1],time.time())
-			else:
-				return (res[3],res[4],res[2],time.time())
-		if self.mode == 'HTTP':
-			getvar = "/blcs/"+var+"?ACTION=GET&METHOD=TEXT"
-			conn = httplib.HTTPConnection(self.host,self.port)
-			conn.request("GET",getvar)
-			retvar = conn.getresponse()
-			line = retvar.read()
-			if string.find(line,"----------") != -1 or retvar.status != 200:
-				raise XCSException, line
-			res = string.split(line,",")
-			conn.close()
-			return (res[2],res[3],res[1],time.time())
-		else:
-			raise XCSException, 'Not Implemented Yet!' 					
-		
-	def set(self, var, values=None):
-		if self.mode == 'TCP':
-			if string.find(var,"UES") != -1:
-				setvar = "UES "+var
-				if values != None:
-					for p,v in values.items():
-						setvar = setvar +" "+str(v)
-			else:
-				setvar = "SET "+var
-				if values != None:
-					for p,v in values.items():
-						setvar = setvar +" "+p+","+str(v)
-			setvar = setvar + "\n"	
-			self.mutex.acquire()
-			try:
-				self.sid.send(setvar)
-				retvar = self.sid.recv(256)
-				
-			finally:
-				self.mutex.release()
-			line = string.split(retvar,"\r")
-			if string.find(line[0],"*** ERROR") != -1:
-				raise XCSException, line[0]
-			return line[0]		
-		else:
-			raise XCSException, 'Not Implemented Yet!' 					
-		
-	def fetch(self,variable):
-		try:
-			a = self.get(variable)
-		except:
-			a = ('0','fetch Exception')
-		return a
-
-
-	def doit(self,target,par1=None,val1=None,par2=None,val2=None):
-		try:
-        		if (par1 == None):
-        			a = self.set(target)
-        		elif (par2 == None):
-				a = self.set(target,{par1:val1} )
-        		else:
-        			a = self.set(target,{par1:val1,par2:val2})
-		except:
-        		a = "  Exception"
-#      		print a
-		return a
+#
+#
+
+import http.client
+import socket
+from threading import Lock
+import time
+
+
+class XCSException(Exception):
+    def __init__(self, value):
+        self.value = value
+
+    def __str__(self):
+        return repr(self.value)
+
+
+class XCS(object):
+    def __init__(self, mode=None):
+        if mode is None:
+            self.mode = "TCP"
+            self.port = 20000
+        elif mode == "HTTP":
+            self.mode = mode
+            self.port = 80
+        else:
+            raise XCSException("Unsupported Mode: " + mode)
+        self.host = ""
+        self.sid = None
+        self.mutex = Lock()
+
+    def open(self, host, port=None):
+        self.host = host
+        if port is not None:
+            self.port = port
+        if self.mode == "TCP":
+            self.mutex.acquire()
+            try:
+                self.sid = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+                self.sid.connect((self.host, self.port))
+            finally:
+                self.mutex.release()
+        elif self.mode == "HTTP":
+            self.sid = 0
+        else:
+            raise XCSException("Not Implemented Yet!")
+
+    def close(self):
+        if self.sid is not None:
+            self.mutex.acquire()
+            try:
+                self.sid.close()
+                self.sid = None
+            finally:
+                self.mutex.release()
+
+    def get(self, var):
+        if self.mode == "TCP":
+            if var.find("UES") != -1:
+                getvar = "GETUES " + var + "\r\n"
+            else:
+                getvar = "GET " + var + "\r\n"
+            self.mutex.acquire()
+            try:
+                self.sid.send(getvar.encode())
+                retvar = self.sid.recv(256).decode()
+            finally:
+                self.mutex.release()
+            line = retvar.split("\r")
+            if line[0].find("*** ERROR") != -1:
+                raise XCSException(line[0])
+            res = line[0].split(",")
+            if var.find("UES") != -1:
+                return res[0], "", res[1], time.time()
+            else:
+                return res[3], res[4], res[2], time.time()
+        if self.mode == "HTTP":
+            getvar = "/blcs/" + var + "?ACTION=GET&METHOD=TEXT"
+            conn = http.client.HTTPConnection(self.host, self.port)
+            conn.request("GET", getvar)
+            retvar = conn.getresponse()
+            line = retvar.read().decode()
+            if line.find("----------") != -1 or retvar.status != 200:
+                raise XCSException(line)
+            res = line.split(",")
+            conn.close()
+            return res[2], res[3], res[1], time.time()
+        else:
+            raise XCSException("Not Implemented Yet!")
+
+    def set(self, var, values=None):
+        if self.mode == "TCP":
+            if var.find("UES") != -1:
+                setvar = "UES " + var
+                if values is not None:
+                    for p, v in list(values.items()):
+                        setvar = setvar + " " + str(v)
+            else:
+                setvar = "SET " + var
+                if values is not None:
+                    for p, v in list(values.items()):
+                        setvar = setvar + " " + p + "," + str(v)
+            setvar = setvar + "\n"
+            self.mutex.acquire()
+            try:
+                self.sid.send(setvar.encode())
+                retvar = self.sid.recv(256).decode()
+            finally:
+                self.mutex.release()
+            line = retvar.split("\r")
+            if line[0].find("*** ERROR") != -1:
+                raise XCSException(line[0])
+            return line[0]
+        else:
+            raise XCSException("Not Implemented Yet!")
+
+    def fetch(self, variable):
+        try:
+            a = self.get(variable)
+        except Exception as e:
+            print(e)
+            a = ("0", "fetch Exception")
+        return a
+
+    def doit(self, target, par1=None, val1=None, par2=None, val2=None):
+        try:
+            if par1 is None:
+                a = self.set(target)
+            elif par2 is None:
+                a = self.set(target, {par1: val1})
+            else:
+                a = self.set(target, {par1: val1, par2: val2})
+        except Exception:
+            a = "  Exception"
+        return a
diff --git a/testsissi.py b/testsissi.py
index 0a51adb4f25817d491b6e0c6280d62e1de4b325d..fb8c93581563838c6abca961d92a9d0030f02105 100644
--- a/testsissi.py
+++ b/testsissi.py
@@ -1,19 +1,19 @@
 #!/usr/bin/python
+import sys
 import telnetlib
 import time
-import sys
-tn=telnetlib.Telnet('ecsproxy',20091)
 
-ans_old=''
+tn = telnetlib.Telnet("ecsproxy", 20091)
+
+ans_old = ""
 while True:
-    tn.write('GET FRONTEND_MACHINE_MACHINE_1_BEAMON')
-    ans = tn.read_until('\n')
+    tn.write("GET FRONTEND_MACHINE_MACHINE_1_BEAMON")
+    ans = tn.read_until("\n")
     if ans != ans_old:
-        print time.ctime(), ans.rstrip(), ' <<<< variazione'
+        print(time.ctime(), ans.rstrip(), " <<<< variazione")
         ans_old = ans
     else:
         pass
-        #print time.ctime(), ans.rstrip()
+    # print time.ctime(), ans.rstrip()
     sys.stdout.flush()
     time.sleep(1)
-