I did observe the problem when using the -U option on Windows 2000. Seems like some infinite recursion in cp1250.py -- see below.
I did not try it with earlier versions of Python. Can this be reproduced on your computer? Thanks for your time and experience, pepr P.S. Thanks, Martin, for the hint. Martin v. Löwis wrote > Petr Prikryl wrote: > > Martin v. Löwis wrote > > > As for dropping the u prefix on string literals: > > > Just try the -U option of the interpreter some time, > > > which makes all string literals Unicode. If you manage > > > to get the standard library working this way, you > > > won't need a per-file decision anymore: just start > > > your program with 'python -U'. > > > I have failed to find the -U option in Python 2.4.2. > [...] > $ python2.4 -U > Python 2.4.2 (#2, Sep 30 2005, 21:19:01) > [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > >>> type("") > <type 'unicode'> > >>> ^D [...] On Windows machine C:\>python -U 'import site' failed; use -v for traceback Python 2.4.3c1 (#68, Mar 23 2006, 10:19:27) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> type('') <type 'unicode'> >>> ^Z See the 'import site' failure. I do use the sitecustomize.py (C:\Python24\Lib\site-packages\sitecustomize.py). It contains ------------------------------------- import sys sys.setdefaultencoding('cp1250') ------------------------------------- I did remove the sitecustomize.pyc before the command. When trying the python -U -v 2>xxx.log, I get the following (shortened): # installing zipimport hook import zipimport # builtin # installed zipimport hook # C:\Python24\lib\site.pyc matches C:\Python24\lib\site.py import site # precompiled from C:\Python24\lib\site.pyc # C:\Python24\lib\os.pyc matches C:\Python24\lib\os.py import os # precompiled from C:\Python24\lib\os.pyc import nt # builtin # C:\Python24\lib\ntpath.pyc matches C:\Python24\lib\ntpath.py import ntpath # precompiled from C:\Python24\lib\ntpath.pyc # C:\Python24\lib\stat.pyc matches C:\Python24\lib\stat.py import stat # precompiled from C:\Python24\lib\stat.pyc # C:\Python24\lib\UserDict.pyc matches C:\Python24\lib\UserDict.py import UserDict # precompiled from C:\Python24\lib\UserDict.pyc # C:\Python24\lib\copy_reg.pyc matches C:\Python24\lib\copy_reg.py import copy_reg # precompiled from C:\Python24\lib\copy_reg.pyc # C:\Python24\lib\types.pyc matches C:\Python24\lib\types.py import types # precompiled from C:\Python24\lib\types.pyc # C:\Python24\lib\locale.pyc matches C:\Python24\lib\locale.py import locale # precompiled from C:\Python24\lib\locale.pyc import _locale # builtin # C:\Python24\lib\codecs.pyc matches C:\Python24\lib\codecs.py import codecs # precompiled from C:\Python24\lib\codecs.pyc import _codecs # builtin import encodings # directory C:\Python24\lib\encodings # C:\Python24\lib\encodings\__init__.pyc matches C:\Python24\lib\encodings\__init__.py import encodings # precompiled from C:\Python24\lib\encodings\__init__.pyc # C:\Python24\lib\encodings\aliases.pyc matches C:\Python24\lib\encodings\aliases.py import encodings.aliases # precompiled from C:\Python24\lib\encodings\aliases.pyc # C:\Python24\lib\encodings\cp1250.pyc matches C:\Python24\lib\encodings\cp1250.py import encodings.cp1250 # precompiled from C:\Python24\lib\encodings\cp1250.pyc import sitecustomize # from C:\Python24\lib\site-packages\sitecustomize.py # wrote C:\Python24\lib\site-packages\sitecustomize.pyc 'import site' failed; traceback: Traceback (most recent call last): File "C:\Python24\lib\site.py", line 397, in ? main() File "C:\Python24\lib\site.py", line 394, in main if hasattr(sys, "setdefaultencoding"): File "C:\Python24\lib\encodings\cp1250.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) File "C:\Python24\lib\encodings\cp1250.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) File "C:\Python24\lib\encodings\cp1250.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) [...snip...] File "C:\Python24\lib\encodings\cp1250.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) File "C:\Python24\lib\encodings\cp1250.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) RuntimeError: maximum recursion depth exceeded # C:\Python24\lib\warnings.pyc matches C:\Python24\lib\warnings.py import warnings # precompiled from C:\Python24\lib\warnings.pyc # C:\Python24\lib\linecache.pyc matches C:\Python24\lib\linecache.py import linecache # precompiled from C:\Python24\lib\linecache.pyc Python 2.4.3c1 (#68, Mar 23 2006, 10:19:27) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> # clear __builtin__._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.exitfunc # clear sys.exc_type # clear sys.exc_value # clear sys.exc_traceback # clear sys.last_type # clear sys.last_value # clear sys.last_traceback # clear sys.path_hooks # clear sys.path_importer_cache # clear sys.meta_path # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup __main__ # cleanup[1] locale # cleanup[1] encodings # cleanup[1] nt # cleanup[1] zipimport # cleanup[1] warnings # cleanup[1] _codecs # cleanup[1] types # cleanup[1] _locale # cleanup[1] sitecustomize # cleanup[1] signal # cleanup[1] linecache # cleanup[1] encodings.aliases # cleanup[1] exceptions # cleanup[1] encodings.cp1250 # cleanup[1] codecs # cleanup[2] copy_reg # cleanup[2] ntpath # cleanup[2] UserDict # cleanup[2] stat # cleanup[2] os # cleanup sys # cleanup __builtin__ # cleanup ints: 7 unfreed ints in 1 out of 8 blocks # cleanup floats (the end) -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo/python-list