summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-07-09 23:16:10 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-07-09 23:16:10 (GMT)
commit0466132ee4c0a96ef6dd936f0b6415991d20e570 (patch)
treef552c5db16d36c8208580182bf4f405654909433 /Lib/locale.py
parentb78165566ef353187f00419cb9c1c18e5dae1383 (diff)
downloadcpython-0466132ee4c0a96ef6dd936f0b6415991d20e570.zip
cpython-0466132ee4c0a96ef6dd936f0b6415991d20e570.tar.gz
cpython-0466132ee4c0a96ef6dd936f0b6415991d20e570.tar.bz2
- repaired locale.py for non-windows platforms. the try/except
checked for the wrong exception. my fault. sorry. (first reported by Alex Coventry)
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index 47f5c4e..1014dbd 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -282,16 +282,19 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
be determined.
"""
+
try:
# check if it's supported by the _locale module
import _locale
code, encoding = _locale._getdefaultlocale()
+ except (ImportError, AttributeError):
+ pass
+ else:
if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name
code = windows_locale.get(int(code, 0))
return code, encoding
- except (ImportError, NameError):
- pass
+
# fall back on POSIX behaviour
import os
lookup = os.environ.get