View Single Post
Old 01-21-2010, 02:34 AM   #1206
evanmaastrigt
Connoisseur
evanmaastrigt doesn't litterevanmaastrigt doesn't litter
 
Posts: 78
Karma: 192
Join Date: Nov 2009
Device: Sony PRS-600
Problem with Wall Street Journal (free) recipe

There is a problem with the Wall Street Journal (free) recipe. It is on line 85:
Code:
            article_date = datetime.strptime(datestring.title(),"%B %d %Y")
The '%B' format specifier uses the local machine's locale for monthname, so this will break with any non-English locale, for instance on my machine with an English OS but Dutch locale:
Code:
ValueError: time data 'January 21 2010' does not match format '%B %d %Y'
The Python documentation warns against changing the locale temporarily: as I understand it, if you change it, the change will affect the whole program, not just your thread. And that might give some unwanted side-effects.
evanmaastrigt is offline