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

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Aug 2001 03:21:11 -0700


Bugs item #430269, was opened at 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: Feature Request
>Status: Closed
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: M.-A. Lemburg (lemburg)
Date: 2001-08-02 03:21

Message:
Logged In: YES 
user_id=38388

Closing this bug report -- please refile as feature request. Python is still a long way from making the standard lib 
play nice with Unicode.

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

Comment By: Walter Dörwald (doerwalter)
Date: 2001-06-09 11:11

Message:
Logged In: YES 
user_id=89016

To make -U more useful as a testbed for Unicode migration, 
it might be useful to change str(), repr() and chr(), so 
that they return Unicode objects when running with python -
U.


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

Comment By: Tim Peters (tim_one)
Date: 2001-06-06 15:51

Message:
Logged In: YES 
user_id=31435

Changed Group from Platform-Specific (since it's got 
nothing to do with Windows specifically) to Feature Request 
(since nobody believes it *should* work now).

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

Comment By: Tim Peters (tim_one)
Date: 2001-06-06 12:28

Message:
Logged In: YES 
user_id=31435

Martin, see email to Python-Dev:  best I can tell, nobody 
expects -U to work yet.

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

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