[Python-bugs-list] [ python-Bugs-476326 ] Unicode and imp.find_module
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 01 Dec 2001 15:01:29 -0800
Bugs item #476326, was opened at 2001-10-30 03:25
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=476326&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
>Priority: 3
Submitted By: Paul Boddie (pboddie)
>Assigned to: M.-A. Lemburg (lemburg)
Summary: Unicode and imp.find_module
Initial Comment:
When a Unicode string is passed as the module name to
imp.find_module, the function fails to import the
named module even when it exists in the specified
path, returning the error message "No module
named ..." as a result.
The problem in Python 2.0 can be traced to line 922 of
Python/import.c which ensures that any strings
involved in the find_module function must be standard
Python strings and not Unicode strings, since it tests
the type of path components against &PyString_Type
explicitly.
Interestingly, the __import__ built-in function seems
to work with Unicode strings. Either way, it would be
great if this could be documented or even fixed, but I
don't know what the policy is on Unicode module names
(even when they only contain ASCII-compatible
characters).
----------------------------------------------------------------------
>Comment By: M.-A. Lemburg (lemburg)
Date: 2001-12-01 15:01
Message:
Logged In: YES
user_id=38388
I guess Python should not except non-ASCII module names, so conversion of Unicode to ASCII should be
appropriate.
Would it suffice to only test this in find_module() or do you think that I need to dig deeper into the import
mechanism ?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=476326&group_id=5470