[wxPython-users] OT - strptime problems

Robin Dunn robin at alldunn.com
Mon Feb 4 10:47:04 PST 2008


Werner F. Bruhin wrote:
> Sorry for being a bit OT.
> 
> I am in the midst of converting over to the Unicode build and I am 
> running into a problem with my custom column sorter for dates
> 
> I wonder if anyone can give me a hint why this would not work:
> 
> x
> u'16 ao\xfbt 2005'
>  >>> tempformat
> u'%d %b %Y'
>  >>> time.strptime(x, tempformat)
>  File "<console>", line 1, in <module>
>  File "C:\Python25\lib\_strptime.py", line 331, in strptime
>    (data_string, format))
> ''' <type 'exceptions.ValueError'> : time data did not match format:  
> data=16 août 2005  fmt=%d %b %Y '''
>  >>> print x
> 16 août 2005
> 
> I tried converting things to string but I still get the same error.  It 
> is strange in my app I actually get a decode error when I run the 
> equivalent code - so I am totally confused.

Does it make any difference if you use strings instead of Unicode 
objects for the date and format?  (Probably need to be encoded to 
whatever is the default system encoding for your locale.)

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list