Does anybody know about this (Google didn't help much for once) ? Is there a workaround ? After instantiating wx.App, the '%p' format does not work any more on Linux (Ubuntu Maverick, python-wxgtk2.8, both with 2.8.11.0 and 2.8.12.1):
import wx, time
time.strftime('%p')
'PM'
wx.PySimpleApp(0)
<wx._core.PySimpleApp; proxy of <Swig Object of type 'wxPyApp *' at 0x28bce50> >
time.strftime('%p')
''
Of course same problem with datetime.time.strftime; this happens when my LANG is set to fr_FR.UTF-8 but not when it's set to C.
Does anybody know about this (Google didn't help much for once) ? Is there a workaround ? After instantiating wx.App, the '%p' format does not work any more on Linux (Ubuntu Maverick, python-wxgtk2.8, both with 2.8.11.0 and 2.8.12.1):
...
Of course same problem with datetime.time.strftime; this happens when
my LANG is set to fr_FR.UTF-8 but not when it's set to C.
Isn't this expected? The usual French standard is to report the time in
24-hour format, which does not use AM and PM. You'd want %p to return
nothing.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Mmmh. I was expecting %p to expand to AM or PM or its translated equivalent, whatever the locale. Looks like I was wrong; a call to strftime(‘%p’) after a locale.setlocale(locale.LC_ALL, ‘fr_FR’) also returns ‘’. The OSX man page does not mention it but the GNU/Linux one says
Note that the return value 0 does not necessarily indicate an error; for
example, in many locales **%p** yields an empty string.
My bad.
BTW the wxWidgets documentation doesn’t say anything about this side-effect of instantiating wx.App does it ? Or is it specific to wxPython ?
Jérôme
···
Le 5 nov. 2012 à 20:21, Tim Roberts timr@probo.com a écrit :
Jérôme Laheurte wrote:
Does anybody know about this (Google didn’t help much for once) ? Is there a workaround ? After instantiating wx.App, the ‘%p’ format does not work any more on Linux (Ubuntu Maverick, python-wxgtk2.8, both with 2.8.11.0 and 2.8.12.1):
…
Of course same problem with datetime.time.strftime; this happens when
my LANG is set to fr_FR.UTF-8 but not when it’s set to C.
Isn’t this expected? The usual French standard is to report the time in
24-hour format, which does not use AM and PM. You’d want %p to return
nothing.
IIRC it is actually GTK that sets the locale to the default when it is initialized, although there has been some discussion about this recently in wx-dev (that I didn't actually pay very much attention to, sorry) so perhaps there will be some changes in behavior coming in a 2.9.x release.
···
On 11/5/12 11:39 AM, J�r�me Laheurte wrote:
BTW the wxWidgets documentation doesn't say anything about this
side-effect of instantiating wx.App does it ? Or is it specific to
wxPython ?
Le 5 nov. 2012 à 21:58, Robin Dunn <robin@alldunn.com> a écrit :
On 11/5/12 11:39 AM, Jérôme Laheurte wrote:
BTW the wxWidgets documentation doesn't say anything about this
side-effect of instantiating wx.App does it ? Or is it specific to
wxPython ?
IIRC it is actually GTK that sets the locale to the default when it is initialized, although there has been some discussion about this recently in wx-dev (that I didn't actually pay very much attention to, sorry) so perhaps there will be some changes in behavior coming in a 2.9.x release.