HDFGroup / HDFGroup/h5serv

PUT attribute String only fills in 1st character of value

Open
#98 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
170
Forks
35
PR merge metrics
No merged PRs in 30d

Description

I am adding an attribute to a dataset I created using the h5server.

The code I used is as follows, mostly copied from attributetest.py file:

```
def putLatestUpdate(year,month,day, uuid):

data = '-'.join([str(year),format(month,'02'),format(day,'02')])
str_type = { 'charSet': 'H5T_CSET_ASCII',
'class': 'H5T_STRING',
'strPad': 'H5T_STR_NULLPAD',
'length': 16}

payload = {'type' : str_type, 'shape': (1,), 'value':data}
req = helper.getEndpoint() + "/groups/" + uuid + "/attributes/latest_update"
rsp = fc.requests.put(req, data=fc.json.dumps(payload), headers=myConfig['headers'])
if (rsp.status_code != 201):
print "Could not create latest date for",data
return None
rspJson = fc.json.loads(rsp.text)
return rspJson
```

The code runs fine and does not show any error, but I noticed that it is only filling in the first value for the attribute. So, if I have year 2016, even though my data = '2016-06-10', the value in my attribute is '2'. If I change it to year = 1000, the value in my attribute is '1'.

Currently the uuid given is one for a group.

What am I doing wrong here?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.