Max Spevack napisal(a):
> It happend right at the beginning. First scanner.py downloaded
data
> for March 2009 for Fedora-Wiki, then it tried to download data for
> February 2009 and the error occurred.
Interesting. This was working last week, the last time I ran it. Maybe
something has changed, I've not been paying attention to the code this
week.
The bug is actually in dateutil module and it affects scanner.py
only when you run it on 31st day of month (February is a special
case of course, because it's shorter)
The code in model.py does a thing like this:
dup.parse('%s %s' % (month, year))
so, if we run it on 30th of March, and we want to parse data for
February 2008 it looks like this:
dup.parse('February 2008')
dup.parse internally adds a number for date which comes from current
date, so it becomes:
dup.parse('February 30 2008')
Now, whenever it tries to convert this string into a datetime.datetime
object, it fails because 30.02.2008 is not a valid date.
Now, imagine that tomorrow on 31st of March we would like to parse some
mail archives but there is no data for February (let's say the archives
start in March). The program will fail anyway while trying to parse
the data for April:
>> dup.parse('March 31 2009')
datetime.datetime(2009, 3, 31, 0, 0)
>> dup.parse('April 31 2009')
Traceback (most
recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python2.5/site-packages/python_dateutil-1.4.1-py2.5.egg/dateutil/parser.py",
line 697, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File
"/usr/local/lib/python2.5/site-packages/python_dateutil-1.4.1-py2.5.egg/dateutil/parser.py",
line 310, in parse
ret = default.replace(**repl)
ValueError: day is out of range for month
I will come up with a solution soon. Applications deadline is
approaching, but I should be on time anyway :)
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/