[Python-bugs-list] [ python-Bugs-476326 ] Unicode and imp.find_module

noreply@sourceforge.net noreply@sourceforge.net
Tue, 30 Oct 2001 03:25:46 -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: 5
Submitted By: Paul Boddie (pboddie)
Assigned to: Nobody/Anonymous (nobody)
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).

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

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