|
Dear Tango-Dancers, I am wondering about this behaviour: I am writing a device property in JSON format via pyTango:
attr_str =''' { ‘name": “demo_spectrum”, ‘dtype": “uint16”, ‘dformat": “SPECTRUM”, ‘writetype": “READ_WRITE”, ‘max_dim_x": 2100, ‘timediff": 0.8, ‘trigger_timeout": 1.2, ‘pv_timeout": 1.2 } '''
db = database() db.put_device_property( self.get_name(), {f ‘pv_{attr_name}’: attr_str } )
Reading and parsing in a JSON object works perfectly.
pv_props = db.get_device_property_list(‘test/lvproxy/1’, ‘pv_*’).value_string for p in pv_props: json_str = db.get_device_property(‘test/lvproxy/1’, p)[p] print(json_str) >>> [' \n {\n "name": "demo_spectrum", \n "dtype": "uint16",\n "dformat": "SPECTRUM", \n ….
However, when I do a manual edit in JIVE, I get an array of strings separated at ‘\n’ positions:
[' ', ' {', ' "name": "demo_spectrum", ', ' "dtype": "uint16",', ' "dformat": "SPECTRUM", ', ' …
Of course, I can solve this problem simply by '\n'.join(str_array) , but this behaviour is still not intuitive for me.
Edited 6 days ago
|