On 2006-05-31  1336, Yaroslav Halchenko wrote:
> 
> > I have this working remedy of overwriting the LANG varible on the
> > commandline, so I won't be investigating further. Now, however, it's
> > known and you should be able to upstream the bug -- right?
> I've composed an email upstream fail2ban and ready to forward it...
> would you mind providing just a bit more detail since I am still
> wondering if it is not time module issue.
> 
> I've attached a tiny python script with 4 commands which might
> help to pin point the issue. Would you mind running it from the same
> environment as fail2ban was ran and then with LANG=en_US, and forwarding
> me output you receive.
> 
> Also 1 sample line from /var/log/auth.log might come handy ;-)
> 
> Thank you in advance
> 
> -- 
>                                   .-.
> =------------------------------   /v\  ----------------------------=
> Keep in touch                    // \\     (yoh@|www.)onerussian.com
> Yaroslav Halchenko              /(   )\               ICQ#: 60653192
>                    Linux User    ^^-^^    [175555]
> 
> 

> #!/usr/bin/python2.3
> 
> import locale
> import time
> 
> print `locale.setlocale(locale.LC_ALL,'')`
> 
> print time.strptime('May 31 09:30:01', '%b %d %H:%M:%S')
> 

It seems that you're right.
# start quote
skrewz:10:48:~$ env | grep LANG
LANG=en_DK
LANGUAGE=en_DK:en_US:en_GB:en
skrewz:10:48:~$ ./yaroslavscript 
'en_DK'
Traceback (most recent call last):
  File "./yaroslavscript", line 8, in ?
    print time.strptime('May 31 09:30:01', '%b %d %H:%M:%S')
  File "/usr/lib/python2.3/_strptime.py", line 402, in ?
    _locale_cache = TimeRE()
  File "/usr/lib/python2.3/_strptime.py", line 318, in __init__
    self.locale_time = LocaleTime()
  File "/usr/lib/python2.3/_strptime.py", line 106, in __init__
    self.__lang = _getlang()
  File "/usr/lib/python2.3/_strptime.py", line 31, in _getlang
    return locale.getlocale(locale.LC_TIME)
  File "/usr/lib/python2.3/locale.py", line 365, in getlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.3/locale.py", line 280, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: en_DK
skrewz:10:49:~$ LANG=en_US ./yaroslavscript 
'en_US'
(1900, 5, 31, 9, 30, 1, 3, 151, -1)
skrewz:10:49:~$ cat yaroslavscript 
#!/usr/bin/python2.3

import locale
import time

print `locale.setlocale(locale.LC_ALL,'')`

print time.strptime('May 31 09:30:01', '%b %d %H:%M:%S')

# end quote
Regards, skrewz.

-- 
  .''`.  Anders Breindahl
 : :' :  smtp:[EMAIL PROTECTED]
 `. ``   http://skrewz.dk
   `-    xmpp:[EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to