Sorry for the lack of details, I thought the stack trace was enough.

I ran a cfmodify command on a cloudfront on a distribution (to add a CNAME) and
then, all calls to cfinfo crashed on this stack.

According to the stack, I think the LastModifiedTime returned by amazon was not understood by s3cmd.
To fix the problem I ran cfmodify again on my distribution. The LastModifiedTime changed, and no problem anymore.

The issue is hard to reproduce because it depends on time.
But I think you can test this bug with dateS3toPython and '2009-05-09T08:37:37.44Z'.

If it can help, I just tried to parse the faulty datetime on egenix mxDateTime library and it was handled fine :
>>> import mx.DateTime
>>> a = mx.DateTime.Parser.DateTimeFromString('2009-05-09T08:37:37.44Z')
>>> a
<mx.DateTime.DateTime object for '2009-05-09 08:37:37.43' at 7f056c9f0df0>

But it's an external library, maybe you want no dependencies.


On Mon, May 11, 2009 at 1:18 AM, Michal Ludvig <michal@logix.cz> wrote:
Hi Matthieu,

thanks for the report. What command did you run? Is the issue
reproducible? CF support seems to work for me just fine in my tests.


Matthieu Huguet wrote:

> Problem: ValueError: time data did not match format:
> data=2009-05-09T08:37:37.44Z  fmt=%Y-%m-%dT%H:%M:%S.000Z
> S3cmd:   0.9.9
> Python:  2.5.2 (r252:60911, Jul 31 2008, 17:31:22)  [GCC 4.2.3 (Ubuntu
> 4.2.3-2ubuntu7)]
> Traceback (most recent call last):
>   File "/usr/bin/s3cmd", line 1562, in <module>
>     main()
>   File "/usr/bin/s3cmd", line 1542, in main
>     cmd_func(args)
>   File "/usr/lib/python2.5/site-packages/S3/CloudFront.py", line 403, in
> info
>     response = cf.GetDistInfo(cfuri)
>   File "/usr/lib/python2.5/site-packages/S3/CloudFront.py", line 264, in
> GetDistInfo
>     response['distribution'] = Distribution(response['data'])
>   File "/usr/lib/python2.5/site-packages/S3/CloudFront.py", line 105, in
> __init__
>     self.parse(tree)
>   File "/usr/lib/python2.5/site-packages/S3/CloudFront.py", line 110, in
> parse
>     self.info <http://self.info>['LastModifiedTime'] =
> dateS3toPython(self.info <http://self.info>['LastModifiedTime'])
>   File "/usr/lib/python2.5/site-packages/S3/Utils.py", line 108, in
> dateS3toPython
>     return time.strptime(date, "%Y-%m-%dT%H:%M:%S.000Z")
>   File "/usr/lib/python2.5/_strptime.py", line 330, in strptime
>     (data_string, format))
> ValueError: time data did not match format:
> data=2009-05-09T08:37:37.44Z  fmt=%Y-%m-%dT%H:%M:%S.000Z