[New-bugs-announce] [issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed

Rob Bairos report at bugs.python.org
Tue Nov 1 19:02:27 CET 2011


New submission from Rob Bairos <rbairos at gmail.com>:

When adding hooks to sys.meta_path, to correctly deal with arbitrarily named non-disk module definitions, module names with slashes should still be processed.

As it stands when executing statements such as:

import my_module_123#/123
or
even
__import__('my_module_123#/123')

the following exception is raised:

ImportError: Import by filename is not supported.

This stops sys.meta_path from handling arbitrarily named modules.

Shouldn't the ImportError be raised *after* the meta_path processing, at which point, its safe to assume the name is a disk name, in which case slashes are relevant?

----------
components: Interpreter Core
messages: 146799
nosy: Rob.Bairos
priority: normal
severity: normal
status: open
title: ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13314>
_______________________________________


More information about the New-bugs-announce mailing list