[wxPython-dev] Bug in wx/_core.py about locale

Robin Dunn robin at alldunn.com
Tue Dec 5 09:09:15 PST 2006


Victor Stinner wrote:
> Hi,
> 
> Someone reported me an error in wxPython:
> 
> File "(...)\wx-2.7.2-msw-unicode\wx\_core.py", line 13684, in <module>
>    default = locale.getdefaultlocale()[1]
> AttributeError: 'module' object has no attribute 'getdefaultlocale'

Strange.  Which version of Python is being used?  According to the docs 
this function has existed since Python 2.0, so the only way that this 
error should be able to happen with a 2.x Python is if there is some 
other module named locale that is being imported rather than the one in 
the standard lib, or if something is explicitly removing the function 
from the module.  Is either of these a possibility?


> 
> You should replace the except by:
>    except (ValueError, LookupError, TypeError, AttributeError):

This smells more like hiding a potential problem than solving it.


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





More information about the wxpython-dev mailing list