From c8c6065231d4595a28fe54d3b8f54cb3d222e537 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 4 Oct 2002 20:49:05 +0000 Subject: [PATCH] When looking for an alias, first look for the normalized name (which still may contain dots), then if that doesn't exist look for the name with dots replaced by underscores. This is a little more forgiving. --- Lib/encodings/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index b928976131f..b2542b8bd74 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -69,7 +69,9 @@ def search_function(encoding): globals(), locals(), _import_tail) except ImportError: import aliases - modname = aliases.aliases.get(modname, modname) + modname = (aliases.aliases.get(modname) or + aliases.aliases.get(modname.replace('.', '_')) or + modname) try: mod = __import__(modname, globals(), locals(), _import_tail) except ImportError: