[issue20163] ValueError: time data does not match format
dellair jie added the comment: We've found a workaround to handle the timestr manually. Thanks, -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
New submission from dellair jie: Hello, We are using Python 3.3.2 for HPUX11.31. The following error happens only on HPUX, works on SunOS, RHEL, AIX. python Python 3.3.2 (default, Dec 9 2013, 14:04:25) [C] on hp-ux11 Type help, copyright, credits or license for more information. from datetime import datetime datetime.strptime (10-Dec-13.20:07:49, %d-%b-%y.%H:%M:%S) Traceback (most recent call last): File stdin, line 1, in module File /python/lib/python3.3/_strptime.py, line 500, in _strptime_datetime tt, fraction = _strptime(data_string, format) File /python/lib/python3.3/_strptime.py, line 337, in _strptime (data_string, format)) ValueError: time data '10-Dec-13.20:07:49' does not match format '%d-%b-%y.%H:%M:%S' It looks like a bug. Could you please shed some lights? Thanks in advance, Br, Li -- components: Library (Lib) messages: 207542 nosy: dellair.jie priority: normal severity: normal status: open title: ValueError: time data does not match format type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
STINNER Victor added the comment: Try to isolate which field fails. Example: import time time.strptime (10-Dec-13.20:07:49, %d-%b-%y.%H:%M:%S) time.struct_time(tm_year=2013, tm_mon=12, tm_mday=10, tm_hour=20, tm_min=7, tm_sec=49, tm_wday=1, tm_yday=344, tm_isdst=-1) time.strptime (10-Dec-13, %d-%b-%y) time.struct_time(tm_year=2013, tm_mon=12, tm_mday=10, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=344, tm_isdst=-1) time.strptime (10-Dec, %d-%b) time.struct_time(tm_year=1900, tm_mon=12, tm_mday=10, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=344, tm_isdst=-1) time.strptime (Dec, %b) time.struct_time(tm_year=1900, tm_mon=12, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=335, tm_isdst=-1) -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
dellair jie added the comment: Victor, Thanks for the comment. Isolated, the error happens at: import time time.strptime (Dec, %b) Traceback (most recent call last): File stdin, line 1, in module File /python/lib/python3.3/_strptime.py, line 494, in _strptime_time tt = _strptime(data_string, format)[0] File /python/lib/python3.3/_strptime.py, line 340, in _strptime data_string[found.end():]) ValueError: unconverted data remains: Dec -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
dellair jie added the comment: The output of command: $ date +'%b' Jan $ uname -a HP-UX test5 B.11.31 U ia64 4201936010 unlimited-user license -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
STINNER Victor added the comment: time.strptime (Dec, %b) ValueError: unconverted data remains: Dec Ok, so what is the name of the December month? import time time.strftime(%b, time.gmtime(1387036705)) 'Dec' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
dellair jie added the comment: We get an empty string for the name. :) time.strftime(%b, time.gmtime(1387036705)) '' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
STINNER Victor added the comment: We get an empty string for the name. :) Ok, it's maybe time to upgrade to Linux :-) (How old is HPUX? I didn't know that it's still in use.) I don't see how Python could workaround the issue if strftime(%b) doesn't work. An option would be to reimplemenet strftime() (in Python?), see #3173. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20163] ValueError: time data does not match format
dellair jie added the comment: Victor, HPUX 11.31 was first released in 2007, we keep upgrading and the latest update is in 2013. ^_^ A workaround sounds fine. By re-implementing strftime(), do you mean to patch it from: http://bugs.python.org/issue1777412? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20163 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com