Skip to content

katcp.Sensor, params not formatted properly #229

Description

@carterb23

Python 3.7:
Following error on v0.7.0 when setting up a sensor:
sens_type = Sensor.parse_type('float')
test_sens = Sensor( sensor_type=sens_type, name='test', params=['0', '1', '2', '3'])
whereas
test_sens = Sensor( sensor_type=sens_type, name='test', params=[0, 1, 2, 3])
works. Sensor class description says:

@var params
@brief List of strings containing the additional parameters (length and
interpretation are specific to the sensor type).

ERROR:

Traceback (most recent call last):
File "E:/Workspace/Projects/MPIfR/GIM/software/python/katcp_client/client_callback.py", line 29, in
main()
File "E:/Workspace/Projects/MPIfR/GIM/software/python/katcp_client/client_callback.py", line 22, in main
client = KatcpClient(opts.host, opts.port)
File "E:\Workspace\Projects\MPIfR\GIM\software\python\katcp_client\esg3_katcp\katcp_client.py", line 87, in init
params=['0', '1', '2', '3']
File "C:\Program Files (x86)\Python3\lib\site-packages\katcp\core.py", line 1098, in init
self.formatted_params = [self._formatter(p, True) for p in params]
File "C:\Program Files (x86)\Python3\lib\site-packages\katcp\core.py", line 1098, in
self.formatted_params = [self._formatter(p, True) for p in params]
File "C:\Program Files (x86)\Python3\lib\site-packages\katcp\kattypes.py", line 115, in pack
return self.encode(value, major)
File "C:\Program Files (x86)\Python3\lib\site-packages\katcp\kattypes.py", line 205, in encode
raise ValueError("Could not encode value '%r' as float." % value)
ValueError: Could not encode value ''0'' as float.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions