python -U problem for 2.4.3c1 on Windows 2000 (was Does -U optionreally exist?)

Discussion in 'Python' started by Petr Prikryl, Mar 27, 2006.

  1. Petr Prikryl

    Petr Prikryl Guest

    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)
     
    Petr Prikryl, Mar 27, 2006
    #1
    1. Advertising

  2. Petr Prikryl wrote:
    > 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?


    I can't try right now. However, I can readily
    believe that Python easily crashes when invoked
    with -U, and I can also believe that it only happens
    on some systems.

    If you care, please research the cause, and submit a
    bug fix. Just submitting the bug report likely won't
    react in action (atleast not from me).

    Regards,
    Martin
     
    =?ISO-8859-2?Q?=22Martin_v=2E_L=F6wis=22?=, Mar 27, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    906
    dave wanta
    Jul 11, 2003
  2. Y.S.
    Replies:
    3
    Views:
    1,042
    strajan
    Sep 17, 2003
  3. LT
    Replies:
    7
    Views:
    2,110
    Phlip
    Jul 25, 2004
  4. Holden Caulfield

    Python 2.3C1 Fails to build ?

    Holden Caulfield, Jul 25, 2003, in forum: Python
    Replies:
    1
    Views:
    319
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Jul 25, 2003
  5. vincent wehren
    Replies:
    2
    Views:
    1,759
    vincent wehren
    Dec 12, 2003
Loading...

Share This Page