[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Rob Bairos rbai...@gmail.com added the comment: Yah, thinking about this further, the real error is that sys.meta_path allows processing of names with #,?* etc. I can see why this would cause problems, as python names must only be _ and alphanumeric characters. I'll re-implement this. Thanks. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Brett Cannon br...@python.org added the comment: This is working as intended. Importers on sys.meta_path should be able to rely on the assumption that the names they are given are syntactically proper module names and not just any random string. You could perform a transform from module name to random string name in an importer or whatever to support some funky naming scheme under the hood. You could also walk sys.meta_path yourself to get around this sanity check, but I see no value in changing import itself to support this use case. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Rob Bairos rbai...@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 rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brett.cannon, ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
New submission from Rob Bairos rbai...@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 rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Changes by Rob Bairos rbai...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13314] ImportError ImportError: Import by filename, should be deferred until sys.meta_path hooks are processed
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com