Hi Werner,
When I tried to duplicate your lines, I get the errors in the (red) lines below.
I tried re-installing python and wxPython, but the error remains.
C:\Documents and Settings\RBARAK>python -v
installing zipimport hook
import zipimport # builtin
installed zipimport hook
D:\Python25\lib\site.pyc has bad mtime
D:\Python25\lib\site.py: inconsistent use of tabs and spaces in indentation
import site # from D:\Python25\lib\site.py
wrote D:\Python25\lib\site.pyc
D:\Python25\lib\os.pyc matches D:\Python25\lib\os.py
import os # precompiled from D:\Python25\lib\os.pyc
import errno # builtin
import nt # builtin
D:\Python25\lib\ntpath.pyc matches D:\Python25\lib\ntpath.py
import ntpath # precompiled from D:\Python25\lib\ntpath.pyc
D:\Python25\lib\stat.pyc matches D:\Python25\lib\stat.py
import stat # precompiled from D:\Python25\lib\stat.pyc
D:\Python25\lib\UserDict.pyc matches D:\Python25\lib\UserDict.py
import UserDict # precompiled from D:\Python25\lib\UserDict.pyc
D:\Python25\lib\copy_reg.pyc matches D:\Python25\lib\copy_reg.py
import copy_reg # precompiled from D:\Python25\lib\copy_reg.pyc
D:\Python25\lib\types.pyc matches D:\Python25\lib\types.py
import types # precompiled from D:\Python25\lib\types.pyc
import types # builtin
import locale # directory D:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\lo
cale
import locale # precompiled from D:\Python25\Lib\site-packages\wx-2.8-msw-unicod
e\wx\locale_init.pyc
D:\Python25\lib\codecs.pyc matches D:\Python25\lib\codecs.py
import codecs # precompiled from D:\Python25\lib\codecs.pyc
import _codecs # builtin
import encodings # directory D:\Python25\lib\encodings
D:\Python25\lib\encodings_init_.pyc matches D:\Python25\lib\encodings__ini
t__.py
import encodings # precompiled from D:\Python25\lib\encodings_init_.pyc
D:\Python25\lib\encodings\aliases.pyc matches D:\Python25\lib\encodings\aliase
s.py
import encodings.aliases # precompiled from D:\Python25\lib\encodings\aliases.py
c
‘import site’ failed; traceback:
Traceback (most recent call last):
File “D:\Python25\lib\site.py”, line 418, in
main()
File “D:\Python25\lib\site.py”, line 409, in main
aliasmbcs()
File “D:\Python25\lib\site.py”, line 358, in aliasmbcs
enc = locale.getdefaultlocale()[1]
AttributeError: ‘module’ object has no attribute ‘getdefaultlocale’
D:\Python25\lib\warnings.pyc matches D:\Python25\lib\warnings.py
import warnings # precompiled from D:\Python25\lib\warnings.pyc
D:\Python25\lib\linecache.pyc matches D:\Python25\lib\linecache.py
import linecache # precompiled from D:\Python25\lib\linecache.pyc
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type “help”, “copyright”, “credits” or “license” for more information.
D:\Python25\lib\encodings\cp862.pyc matches D:\Python25\lib\encodings\cp862.py
import encodings.cp862 # precompiled from D:\Python25\lib\encodings\cp862.pyc
import locale
locale.getdefaultlocale
Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘module’ object has no attribute ‘getdefaultlocale’
Any suggestions how to make my Python+wx operational again ?
Bye,
Ron.
···
From: Werner F. Bruhin
Sent: Monday, 08 September, 2008 17:47
To:
wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] importing from wx started producing AttributeError in “wx-2.8-msw-unicode\wx_core.py” (update 1)
Ron,
Barak, Ron wrote:
Hi Fellow Pythonians,
After a Windows reboot, I found that something is wrong with my
wxPython installation.
I reduce my script to the following one liner, to demonstrate the
problem:
*$ cat test.py
*#! /usr/bin/env python
from wx import xrc
*$ python test.py
*'import site' failed; use -v for traceback
Traceback (most recent call last):
File "test.py", line 3, in <module>
from wx import xrc
File
"D:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\xrc.py", line
59, in <module>
import _core
File
"D:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 14472, in <module>
default = locale.getdefaultlocale()[1]
AttributeError: 'module' object has no attribute 'getdefaultlocale'
I didn’t try your script, but just did this in the Boa shell.
from wx import xrc
import locale
locale.getdefaultlocale
<function getdefaultlocale at 0x01B671B0>
to me your problem doesn’t look like there is something wrong with your wxPython install, but something “stepped” onto your locale module.
Werner