Issue 787113: zipimport on meta_path fails with mutual importers (original) (raw)

Issue787113

Created on 2003-08-12 02:25 by timmcl, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (3)
msg17723 - (view) Author: Tim McLennan (timmcl) Date: 2003-08-12 02:25
If I create a simple package consisting of a package/__init__.py containing: print "Package: "+__name__ import module and a package/module.py containing: print "Module: "+__name__ import package and zip the directory resulting directory up, then it imports fine if I add the zip to sys.path However if Instead create a zipimporter object and add it to the meta_path then I get a whole heap of recursive imports resulting in output of the following form: Package: package Module: package.module Package: package.package Module: package.package.module Package: package.package.package Module: package.package.package.module Package: package.package.package.package Module: package.package.package.package.module Package: package.package.package.package.package .... before finally running into an exception: ValueError: Module name too long For reference my version string is '2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)]'
msg17724 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-08-13 14:30
Logged In: YES user_id=92689 Hm, good catch! I don't see an obvious fix for this, and I worry that this is the result of a design flaw in the interaction between meta importers and path importers. For now, I think I should document that the zipimporter object is not suited for use on sys.meta_path. I need to do more thinking here.
msg85158 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-02 04:13
The zipimporter is not designed to work on sys.meta_path, so closing as "won't fix".
History
Date User Action Args
2022-04-10 16:10:36 admin set github: 39051
2009-04-02 04:13:34 brett.cannon set status: open -> closedresolution: wont fixmessages: +
2009-02-11 02:50:47 ajaksu2 set assignee: jvr -> brett.cannonnosy: + brett.cannon
2008-01-05 18:05:19 christian.heimes set components: + Documentation, Library (Lib), - Noneversions: + Python 2.6, Python 2.5
2003-08-12 02:25:41 timmcl create