leschweitzer / solrpy

Automatically exported from code.google.com/p/solrpy
0 stars 0 forks source link

conversion of ISO 8601 format does not work with datetime #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use Python >= 2.5
2. use solrpy and query something

What is the expected output? What do you see instead?
I see the following trace instead of a proper response:

  File ".../solr.py", line 873, in endElement
    node.final = utc_from_string(value.strip().strip())
  File ".../solr.py", line 1015, in utc_from_string
    return datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ")
  File ".../python2.5/_strptime.py", line 331, in strptime
    (data_string, format))
ValueError: time data did not match format:  data=2008-07-03T14:47:09.577Z
 fmt=%Y-%m-%dT%H:%M:%SZ

What version of the product are you using? On what operating system?
I am using solrpy rev 5 on Mac OS X 10.5

Please provide any additional information below.
At the very bottom of solrpy you distinguish between python < 2.5 and
higher. The 'old' version of utc_from_string works for me. The 'new' one
does not. It actually seems that python datetime does not support ISO 8601
format, well not the float part of the seconds.

I think just using the 'old' version of utc_from_string does the trick. At
least for me it works. Or are there any drawbacks in it I should know?

Do you have a mailing list or forum for this project? This project seems to
be the best solr interface for python.

Cheers,

Christian

Original issue reported on code.google.com by christia...@gmail.com on 9 Jul 2008 at 1:21

GoogleCodeExporter commented 9 years ago
Fixed in r8, there's only one solr.utc_from_string now (the 'old' one) which 
does support up to 3 decimal places. The only drawback I can see is a couple
of nanoseconds lost on doing manual parsing but I don't think it can
ever be a bottleneck ;-) 

There's no mailing list yet but there definitely will be in near future.

Original comment by ds...@gefira.pl on 12 Sep 2008 at 8:34