Skip to content
Snippets Groups Projects
Commit 5bf3a0f8 authored by BRONES Romain's avatar BRONES Romain
Browse files

[ContextSaver] Array Fix, Catch exception

* Add a little more debug messages.
* If attribute is numpy array, convert to python list.
  We have to do so to serialize with json.
* Catch exception when trying to access attribute.
  We signal a warning. The defualt case is with an attribute that has
  no name...
parent a9f795d2
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import PyTango as tango
import logging
import argparse
import json
import numpy
__version__ = "1.0.0"
......@@ -32,15 +33,25 @@ def get_wattr(proxy):
# Scan all attributes
for attr in proxy.get_attribute_list():
if proxy.get_attribute_config(attr).writable in [
tango.AttrWriteType.WRITE,
tango.AttrWriteType.READ_WRITE,
tango.AttrWriteType.READ_WITH_WRITE]:
config[attr]=proxy[attr].value
logger.debug("Detect writtable attribute %s = %s"%(
attr,
proxy[attr].value))
logger.debug("Analyse attribute '%s' "%(
attr))
try:
if proxy.get_attribute_config(attr).writable in [
tango.AttrWriteType.WRITE,
tango.AttrWriteType.READ_WRITE,
tango.AttrWriteType.READ_WITH_WRITE]:
v= proxy[attr].value
if type(v) is numpy.ndarray:
v=v.tolist()
config[attr]=v
logger.debug("Detect writtable attribute '%s' = %s"%(
attr,
proxy[attr].value))
except tango.DevFailed:
logger.warning("Failed to save attribute '%s'"%attr)
return config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment