Lima-tango-python issueshttps://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues2023-12-15T08:30:22+01:00https://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/66Missing __annotations__ on callables readers/writers2023-12-15T08:30:22+01:00Samuel DebionneMissing __annotations__ on callables readers/writers```
$ LimaCCDs bcu_simulator1_devel
-------> Received a DevFailed exception: DevFailed[
DevError[
desc = AttributeError: 'CallableReadEnum' object has no attribute '__annotations__'
origin = Traceback (most recent call last):
Fi...```
$ LimaCCDs bcu_simulator1_devel
-------> Received a DevFailed exception: DevFailed[
DevError[
desc = AttributeError: 'CallableReadEnum' object has no attribute '__annotations__'
origin = Traceback (most recent call last):
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/tango/device_class.py", line 669, in __DeviceClass__device_factory
device = self._new_device(deviceImplClass, klass, dev_name)
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/tango/device_class.py", line 648, in __DeviceClass__new_device
return klass(dev_class, dev_name)
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/Lima/Server/LimaCCDs.py", line 400, in __init__
self.init_device()
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/Lima/Core/Debug.py", line 64, in real_fn
return new_fn(*arg, **kw)
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/Lima/Server/LimaCCDs.py", line 734, in init_device
self.add_attribute(
File "/users/blissadm/conda/miniconda/envs/lima_dev/lib/python3.9/site-packages/tango/device_server.py", line 572, in __DeviceImpl__add_attribute
type_hint = dict(r_meth.__annotations__).get("return", None)
AttributeError: 'CallableReadEnum' object has no attribute '__annotations__'
reason = PyDs_PythonError
severity = ERR]
]
```
with
```
$ conda list pytango
# packages in environment at /users/blissadm/conda/miniconda/envs/lima_dev:
#
# Name Version Build Channel
pytango 9.5.0 py39hb1babde_1 conda-forgev1.9.20Samuel DebionneSamuel Debionnehttps://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/56BPM plugin starts with UNKNOWN state2022-06-21T09:15:23+02:00Samuel DebionneBPM plugin starts with UNKNOWN stateSubsequent calls to `RunLevel` fail with `it is currently not allowed to write attribute RunLevel. The device state is UNKNOWN`Subsequent calls to `RunLevel` fail with `it is currently not allowed to write attribute RunLevel. The device state is UNKNOWN`Samuel DebionneSamuel Debionnehttps://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/41task() can return None2021-03-26T14:18:53+01:00Matias Guijarrotask() can return NoneObserved in BLISS tests:
```
Traceback (most recent call last):
File "/opt/conda/envs/testenv/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/opt/conda/envs/testenv/lib/python3.7/site-packages/Lima/S...Observed in BLISS tests:
```
Traceback (most recent call last):
File "/opt/conda/envs/testenv/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/opt/conda/envs/testenv/lib/python3.7/site-packages/Lima/Server/plugins/Bpm.py", line 628, in run
while self._task()._stop is False:
AttributeError: 'NoneType' object has no attribute '_stop'
```Laurent ClaustreLaurent Claustrehttps://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/35Image events are never pushed.2021-01-08T20:56:21+01:00Damien NaudetImage events are never pushed.ImageStatusCallback never pushes events because of how the last event time is stored: it is always updated even when no events is sent, and the comparison is wrong anyway (current time < next time instead of current time >= next time).
A...ImageStatusCallback never pushes events because of how the last event time is stored: it is always updated even when no events is sent, and the comparison is wrong anyway (current time < next time instead of current time >= next time).
Also, the way it's done, you can miss the last frame, so I suggest sending it when:
- last_acquired == -1
- status changed (this way there's an even when the last frame of an acquisition is available, because the status is back to "AcqReady" when the callback is called)
- current time > last event time + delay
@claustre
@debionneDamien NaudetDamien Naudethttps://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/27Python3: plugin code still has references to removed itertools.izip2021-01-15T14:32:35+01:00Alejandro Homs PuronPython3: plugin code still has references to removed itertools.izip`itertools.izip` was removed in Python3. References to it remain in the code:
```
blissadm@lid02eiger2lima:~/Git/Lima/applications/tango/python$ git grep izip
plugins/Bpm.py: return itertools.izip(*[itertools.chain(iterable, itertool...`itertools.izip` was removed in Python3. References to it remain in the code:
```
blissadm@lid02eiger2lima:~/Git/Lima/applications/tango/python$ git grep izip
plugins/Bpm.py: return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
plugins/Memcached.py:# return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
plugins/PeakFinder.py: return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
plugins/Roi2Spectrum.py: return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
```
The suggested solution is to apply the patch in d9a29084:
``` diff
diff --git a/plugins/RoiCounter.py b/plugins/RoiCounter.py
index 4c0eb12..ad06573 100644
--- a/plugins/RoiCounter.py
+++ b/plugins/RoiCounter.py
@@ -30,7 +30,7 @@ from Lima import Core
from Lima.Server.plugins.Utils import getDataFromFile,BasePostProcess
def grouper(n, iterable, padvalue=None):
- return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
+ return zip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
RoiCounterTask = Core.Processlib.Tasks.RoiCounterTask
```
Another alternative, which allows still using `itertools.izip` in Python2 (probably not worth), was applied in Lima-camera-simulator@c6fa7a57:
``` diff
diff --git a/tango/Simulator.py b/tango/Simulator.py
index 0a08528..8220d57 100644
--- a/tango/Simulator.py
+++ b/tango/Simulator.py
@@ -26,13 +26,19 @@
import itertools
import PyTango
+# python3 compat
+try:
+ from itertools import izip as zip
+except ImportError:
+ pass
+
from Lima.Server import AttrHelper
from Lima import Core
from Lima import Simulator as SimuMod
def grouper(n, iterable, padvalue=None):
- return itertools.izip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
+ return zip(*[itertools.chain(iterable, itertools.repeat(padvalue, n-1))]*n)
class Simulator(PyTango.Device_4Impl):
```
In any case, the solution should be uniform inside the repository, that is, for the following files:
```
blissadm@lid02eiger2lima:~/Git/Lima/applications/tango/python$ git grep 'def grouper'
plugins/Bpm.py:def grouper(n, iterable, padvalue=None):
plugins/Memcached.py:# def grouper(n, iterable, padvalue=None):
plugins/PeakFinder.py:def grouper(n, iterable, padvalue=None):
plugins/Roi2Spectrum.py:def grouper(n, iterable, padvalue=None):
plugins/RoiCounter.py:def grouper(n, iterable, padvalue=None):
```https://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/17Eventing not working with Tango 9.3.22019-10-11T13:27:45+02:00Stuart FisherEventing not working with Tango 9.3.2Eventing was working fine with Tango 9.2.5a, however after upgrading to 9.3.2 from the tango-controls channel i no longer get events from lima devices.
I have tested that eventing in general is working in tango by building a test device...Eventing was working fine with Tango 9.2.5a, however after upgrading to 9.3.2 from the tango-controls channel i no longer get events from lima devices.
I have tested that eventing in general is working in tango by building a test device from this pytest:
https://github.com/tango-controls/pytango/blob/566c549eaa7b6b3cbb87152f1bdaec137e6c49a9/tests/test_event.py#L41
and can confirm that the following works:
```
test = PyTango.DeviceProxy('id00/event/test')
def cb(data):
print('cb', data)
test.subscribe_event('attr', PyTango.EventType.CHANGE_EVENT, cb)
test.send_event()
cb EventData[
attr_name = 'tango://el7.localdomain:10000/id00/event/test/attr'
attr_value = DeviceAttribute(data_format = tango._tango.AttrDataFormat.SCALAR, dim_x = 1, dim_y = 0, has_failed = False, is_empty = False, name = 'attr', nb_read = 1, nb_written = 0, quality = tango._tango.AttrQuality.ATTR_VALID, r_dimension = AttributeDimension(dim_x = 1, dim_y = 0), time = TimeVal(tv_nsec = 0, tv_sec = 1570024492, tv_usec = 219171), type = tango._tango.CmdArgType.DevDouble, value = 1.0, w_dim_x = 0, w_dim_y = 0, w_dimension = AttributeDimension(dim_x = 0, dim_y = 0), w_value = None)
device = EventDevice(id00/event/test)
err = False
errors = ()
event = 'change'
reception_date = TimeVal(tv_nsec = 0, tv_sec = 1570024492, tv_usec = 219427)]
```
Now to the problem in hand, the Bpm device no longer seems to send the bvdata event.
I have tried
* enabling TangoEvent on my LimaCCDs device, then subscribe to last_image. Run prepareAcq(), startAcq() -> no events
* With @claustre we have tested that the push is happening from the BVDataTask via print trace, however subscription to bvdata from the Bpm device -> no events
* have confirmed that `enable_tango_event` from https://gitlab.esrf.fr/limagroup/Lima-tango-python/blob/master/plugins/Bpm.py#L94 is True
Not sure what has caused this?https://gitlab.esrf.fr/limagroup/Lima-tango-python/-/issues/2Python 3 syntax errors2018-09-19T16:39:15+02:00Samuel DebionnePython 3 syntax errorsTesting with
```
python -m py_compile <file.py>
```
shows that there are remaining issues with Python 3.Testing with
```
python -m py_compile <file.py>
```
shows that there are remaining issues with Python 3.Samuel DebionneSamuel Debionne