Hey guys,
I got some kind of (probably threading) error when setting a DevULong64 attribute via PyTango.
My code:
import PyTango
import numpy
dev = PyTango.DeviceProxy('tango://localhost:10000/test/if/do')
dev.value = numpy.uint64(42)
When I run the code as script, I get:
Exception SystemError: '../Objects/longobject.c:980: bad argument to internal function' in <module 'threading'="" from="" '="" usr="" lib="" python2.7="" threading.pyc'=""> ignored</module>
In interactive mode, I get:
SystemError: ../Objects/longobject.c:980: bad argument to internal function
I have done some investigation and it seems that the exception is triggered by the assignment to the value attribute, but not immediately.
If I add a print statement after the assignment, it is executed before the exception occurs.
The used Tango device is a simple device with a r/w 'value' attribute of type 'DevULong64'.
System info:
Tango: 8.0.5
PyTango: 8.0.3
numpy: 1.7.1
Python: 2.7.3
Distribution: Ubuntu 12.04
Kernel: 3.2.0-38-generic
Arch: x86_64
PyTango was installed via easy_install.
Hello Alexander,
You are right:
On the client side, for scalar attributes, PyTango is not supporting numpy data types.
For now you can do a quick hack:
dev.value = long(42) # or dev.value = 42L
(warning: this hack will probably not work on python 3)
See also bug #527
( https://sourceforge.net/p/tango-cs/bugs/527/ )
It will take some effort to solve this so I have to postpone a final fix only for PyTango >= 8.1.1
Let me know if the hack is not enough for you
Fixed in PyTango SVN trunk since revision #24330.
Will become visible in next PyTango release 8.1.1