Bugs item #1280061, was opened at 2005-09-01 13:06 Message generated for change (Comment added) made by meonkeys You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1280061&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Adam Monsen (meonkeys) Assigned to: Brett Cannon (bcannon) Summary: time.strptime() fails with unicode date string, de_DE locale Initial Comment: Trying to parse a German date string fails in Python 2.4.1. Test case attached. Since there's no indenting, I suppose the test case can also be pasted here: import locale, time locale.setlocale(locale.LC_TIME, 'de_DE') date = u'10. September 2005 um 17:26' format = '%d. %B %Y um %H:%M' time.strptime(date, format) -- Adam Monsen http://adammonsen.com/ ---------------------------------------------------------------------- >Comment By: Adam Monsen (meonkeys) Date: 2005-09-02 13:57 Message: Logged In: YES user_id=259388 I get a str from time.strftime(). >>> import time >>> time.strftime('%B') 'September' >>> time.strftime('%B').__class__ <type 'str'> ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2005-09-02 13:37 Message: Logged In: YES user_id=357491 Can you let me know what time.strftime() outputs for your test case, specifically what type of basestring (str or unicode)? ---------------------------------------------------------------------- Comment By: Adam Monsen (meonkeys) Date: 2005-09-02 09:43 Message: Logged In: YES user_id=259388 Here's a simpler, more precise test case (also attached): import locale, time locale.setlocale(locale.LC_TIME, 'de_DE') date = u'September'; format = '%B' time.strptime(date, format) Here's the error I see: Traceback (most recent call last): File "de_strptime_fail_simple.py", line 4, in ? time.strptime(date, format) File "/usr/lib/python2.4/_strptime.py", line 329, in strptime month = locale_time.f_month.index(found_dict['B'].lower()) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 1: ordinal not in range(128) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1280061&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com