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

Rob Bairos report at bugs.python.org
Thu Nov 3 22:36:32 CET 2011


Rob Bairos <rbairos at gmail.com> added the comment:

Why is a module name syntactically improper simply because it contains a slash?  That seems an arbitrary definition, that serves no purpose, except to discourage accidentally specifying a filename.

Module with unusual characters all reach the meta_path stage,
eg:  my,mo*d1?2my##m;o#d13

But as soon as a slash is introduced, a warning that filenames not being supported is thrown.

1) If the issue is that its not syntactically correct, it should state so.
2) If the issue is that its not syntactically correct, the syntax of a module name should be documented to include *,?#  or throw the same exception.
3) Whats the purpose of the 'Import my filename' exception anyhow? Will it not fail soon thereafter at any rate?

This behaviour is definitely inconsistent and arbitrary.

----------
status: closed -> open

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


More information about the Python-bugs-list mailing list