Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error deserializing datetime value from Table Store #80

Closed
timanovsky opened this issue Apr 29, 2013 · 2 comments
Closed

Error deserializing datetime value from Table Store #80

timanovsky opened this issue Apr 29, 2013 · 2 comments

Comments

@timanovsky
Copy link

Traceback (most recent call last):
File "./list-registrar-table.py", line 9, in
key_list = ts.query_entities('registrar')
File "/Users/timanovsky/tmp/azure/env/lib/python2.7/site-packages/azure/storage/tableservice.py", line 219, in query_entities
return _convert_response_to_feeds(response, _convert_xml_to_entity)
File "/Users/timanovsky/tmp/azure/env/lib/python2.7/site-packages/azure/init.py", line 325, in _convert_response_to_feeds
feeds.append(convert_func(new_node.toxml('utf-8')))
File "/Users/timanovsky/tmp/azure/env/lib/python2.7/site-packages/azure/storage/init.py", line 698, in _convert_xml_to_entity
property = conv(value)
File "/Users/timanovsky/tmp/azure/env/lib/python2.7/site-packages/azure/storage/init.py", line 485, in _from_entity_datetime
return datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '2013-02-09T04:36:10.325Z' does not match format '%Y-%m-%dT%H:%M:%SZ'

@huguesv
Copy link
Contributor

huguesv commented Apr 29, 2013

Please try to change the implementation to this and let us know:

def _from_entity_datetime(value):
    format = '%Y-%m-%dT%H:%M:%S'
    if '.' in value:
        format = format + '.%f'
    if value.endswith('Z'):
        format = format + 'Z'
    return datetime.strptime(value, format)

@timanovsky
Copy link
Author

It works

@ghost ghost closed this as completed Jul 15, 2013
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants