[Python-bugs-list] [ python-Bugs-430269 ] python -U breaks import with 2.1

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Jun 2001 00:21:37 -0700


Bugs item #430269, was updated on 2001-06-05 03:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=430269&group_id=5470

Category: Unicode
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: M.-A. Lemburg (lemburg)
Summary: python -U breaks import with 2.1

Initial Comment:
python -U under Windows is broken with Python 2.1:

D:\>python
Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license" for more 
information.
>>> import urllib
>>>
^C
D:\>python -U
Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license" for more 
information.
>>> import urllib
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named urllib


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2001-06-06 00:21

Message:
Logged In: YES 
user_id=21627

The (first) problem appears to be in string.py, which has
_idmap = ''
for i in range(256): _idmap = _idmap + chr(i)

With -U, _idmap is a unicode string, and adding chr(128) 
to it will give an ASCII decoding error. Therefore, 
importing string fails. In turn, many other things fail as 
well.

That can be solved by writing
_idmap=str('')
but then it will still complain that distutils.util cannot 
be imported in site. One problem may be that site.py 
changes the strings of sys.path into Unicode strings. In 
fact, when starting Python with -U -S, it will properly 
locate urllib.


----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-06-05 18:04

Message:
Logged In: YES 
user_id=31435

Assigned to Marc-Andre.  M-A, do you expect -U to be useful 
at this point?  I thought I saw docs at one point, but 
can't seem to find them again ...


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=430269&group_id=5470