Bug 838647 - with LANG=zh_CN.utf set, datetime.datetime.strptime('%x', time.strftime('%x')) fails
with LANG=zh_CN.utf set, datetime.datetime.strptime('%x', time.strftime('%x')...
Status: NEW
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Python Maintainers
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-09 13:15 EDT by Adrian Likins
Modified: 2015-07-01 03:03 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Python 8957 None None None Never

  None (edit)
Description Adrian Likins 2012-07-09 13:15:44 EDT
Description of problem:

if LANG is set to zh_CN.UTF8, the python code like:

import datetime
import time
import os
import locale

os.environ['LANG'] = "zh_CN.utf8"
locale.setlocale(locale.LC_ALL, '')

print datetime.datetime.strptime('%x', time.strftime('%x'))


ie, trying to parse the localized date format with strptime
fails even when using the same format ('%x') 


I suspect this might be related to 
https://bugzilla.redhat.com/show_bug.cgi?id=785984, though trying:
  LANG=zh_CN.utf8 date --date="$(date +'%x' -d '10/11/2011') " "+%x"

Seems to work okay.



[adrian@dhcp231-28 ~]$ rpm -q python glibc-common
python-2.6.6-29.el6_2.2.x86_64
glibc-common-2.12-1.80.el6.x86_64
Comment 2 RHEL Product and Program Management 2012-12-14 03:38:43 EST
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 3 Bohuslav "Slavek" Kabrda 2014-02-14 06:34:20 EST
I'm linking upstream bug that tries to address this, currently without a viable solution, I think.
Comment 4 Bohuslav "Slavek" Kabrda 2015-01-07 09:06:41 EST
Since upstream still hasn't agreed on solution and this has a potential of behaviour change, I'm moving this bug to 6.8.

Note You need to log in before you can comment on or make changes to this bug.