azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

def _from_entity_datetime(value) in __init__.py returns 7 for seconds

Open themaxx75 opened this issue 13 years ago • 5 comments

the content of "value" in from_entity_datetime has 7 digits after the "." This causes "ValueError: time data '2013-10-10T18:46:06.6206463Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'"

stripping the last digit fixes the crash in my case. Essentially patched the function with "value = value[:-2] + "Z"" Using Ubuntu 13.10 with Python 2.75 https://github.com/WindowsAzure/azure-sdk-for-python/blob/master/src/azure/storage/init.py#L507

themaxx75 avatar Oct 31 '13 01:10 themaxx75

Thanks for letting us know about this. I'm guessing that value was saved to table storage using a different sdk/tool? We don't currently save the fractions of a second when saving the value in table storage in the python sdk.

According to: http://www.w3.org/TR/NOTE-datetime

An adopting standard that permits fractions of a second must specify both the minimum number of digits (a number greater than or equal to one) and the maximum number of digits (the maximum may be stated to be "unlimited").

But Azure doesn't specify it: http://msdn.microsoft.com/en-us/library/windowsazure/dd894027.aspx

So I guess we have to handle unlimited number of digits.

strftime expects %f to be: Microsecond as a decimal number [0,999999] http://strftime.org/

So we'll change it to trim to 6 digits.

huguesv avatar Nov 01 '13 00:11 huguesv

Thanks for taking to time to look into it. The files were uploaded with an app built in .Net, which I'm not involved with.

On Thu, Oct 31, 2013 at 8:27 PM, huguesv [email protected] wrote:

Thanks for letting us know about this. I'm guessing that value was saved to table storage using a different sdk/tool? We don't currently save the fractions of a second when saving the value in table storage in the python sdk.

According to: http://www.w3.org/TR/NOTE-datetime

An adopting standard that permits fractions of a second must specify both the minimum number of digits (a number greater than or equal to one) and the maximum number of digits (the maximum may be stated to be "unlimited").

But Azure doesn't specify it: http://msdn.microsoft.com/en-us/library/windowsazure/dd894027.aspx

So I guess we have to handle unlimited number of digits.

strftime expects %f to be: Microsecond as a decimal number [0,999999] http://strftime.org/

So we'll change it to trim to 6 digits.

— Reply to this email directly or view it on GitHubhttps://github.com/WindowsAzure/azure-sdk-for-python/issues/116#issuecomment-27540179 .

themaxx75 avatar Nov 01 '13 00:11 themaxx75

Sorry this didn't get fixed for 0.7.1. The fix for this was simple, but it was tied up with the fix for #114 which we couldn't do for 0.7.1. We'll get to it soon, though.

huguesv avatar Nov 08 '13 19:11 huguesv

That's great! Nice to see a follow up as well. Appreciate the time you guys take to let us know what is happening.

themaxx75 avatar Nov 08 '13 23:11 themaxx75

Hi, just got the lib today and seems this issue exists. I have entries in my table storage saved with the usual Enteprise Lib SLAB Logger. The Timestamp column has microseconds up to 7 digits and it's causing an error as mentioned. I manually patched it by truncating the last digit in _from_entity_datetime(value) in init.py

Is this going to be fixed?

skeevs avatar May 12 '14 10:05 skeevs