Fredrik Lundh wrote: > > [fredrik@brain src]$ export LANG=foobar > [fredrik@brain src]$ ./python > 'import site' failed; use -v for traceback > Python 2.0b1 (#4, Jul 7 2000, 12:23:15) [GCC egcs-2.91.66 19990314/Linux > (egcs-1.1.2 release)] on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > Copyright 1995-2000 Corporation for National Research Initiatives (CNRI) > >>> > > that "import site" is a bit disturbing. maybe the locale-checking > code should handle this case a bit more gracefully? > > (like, say, printing a more explicit warning message). Here's the patch (Skip's locking the Lib dir ... grrr ;-): --- CVS-Python/Lib/site.py Wed Jun 28 17:30:57 2000 +++ Python+Unicode/Lib/site.py Fri Jul 7 21:30:54 2000 @@ -124,11 +124,16 @@ del exit # encoding used by the default locale of this system. If the default # encoding cannot be determined or is unknown, it defaults to 'ascii'. # def locale_aware_defaultencoding(): import locale - code, encoding = locale.get_default() + try: + code, encoding = locale.get_default() + except ValueError, why: + sys.stderr.write('Error setting default encoding (%s), using ASCII.\n' + % why) + encoding = None if encoding is None: encoding = 'ascii' try: sys.setdefaultencoding(encoding) except LookupError: -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4