[Spambayes] Question (or possibly a bug report)

Meyer, Tony T.A.Meyer at massey.ac.nz
Thu Jul 24 11:53:53 EDT 2003


[Mark]
> Does anyone know how I can provoke Python under an English 
> windows to think that the decimal point is other than a period?
[Tim]
> Surprise:  you can't, not from Python.  Reading the docs for 
> Python's locale module will help -- if you read them back to 
> front <wink>.
[Python docs 6.26.2]
> The setlocale() function in the locale module gives the Python
> programmer the impression that you can manipulate the LC_NUMERIC
> locale setting, but this not the case at the C level: C code will
> always find that the LC_NUMERIC locale setting is "C".

No doubt I should ask this on python-list not here, but since Tim would
probably be the one to answer it anyway... :)  Why does the setlocale()
function give that impression?  If LC_NUMERIC should always be "C",
shouldn't setlocale(LC_NUMERIC, x) raise some sort of exception?

> It's a hack, but it's usually effective.  If LC_NUMERIC is 
> anything other than "C" when Python is running, it must be 
> because some non-Python part of the system called C's 
> setlocale() itself.  Then Python's belief that LC_NUMERIC is 
> always "C" can be wrong, and bad things follow.

Maybe Outlook is at fault here?  I've certainly seen that some of the
Outlook/COM/MAPI calls make changes to the locale.  In particular,
mapi.MAPILogonEx() does - it changes the locale to whatever Outlook
(i.e. Windows) thinks it is.  Could this then be screwing things up for
us?

=Tony Meyer



More information about the Spambayes mailing list