This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年03月12日 20:30 by Andrey.Antsut, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| reproduce.zip | Andrey.Antsut, 2014年03月12日 20:30 | |||
| Messages (3) | |||
|---|---|---|---|
| msg213290 - (view) | Author: Andrey Antsut (Andrey.Antsut) | Date: 2014年03月12日 20:30 | |
Importing modules from subdirectories as "implicit namespace packages" (PEP 420) inside a ZIP archive only works one level deep. Imports from within nested namespaces fail with "ImportError: No module named 'XXX'". I am attaching an archive with example directory/file structure. To reproduce the problem, run the following from where you unzipped it: python >>> import sys >>> sys.path += ['project1', 'project2.zip', 'project3', 'project4.zip'] >>> import parent.child.hello1 Hello 1 >>> import parent.child.hello2 ImportError: No module named 'parent.child.hello2' >>> import parent.child.hello3 Hello 3 >>> import parent.child.hello4 ImportError: No module named 'parent.child.hello4' >>> import boo boo! >>> import parent.boo boo! Tested on WinXP SP3 with Python 3.3.5 and 3.4.0rc3. |
|||
| msg364937 - (view) | Author: Jonathan Hsu (Jonathan Hsu) * | Date: 2020年03月24日 15:54 | |
It appears this issue has been fixed, as I am unable to reproduce it on Windows 10/Python 3.7: Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path += ['project1', 'project2.zip', 'project3', 'project4.zip'] >>> import parent.child.hello1 Hello 1 >>> import parent.child.hello2 Hello 2 >>> import parent.child.hello3 Hello 3 >>> import parent.child.hello4 Hello 4 >>> import boo boo! >>> import parent.boo boo! |
|||
| msg408056 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年12月09日 00:15 | |
I got the same results as Jonathan. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:59 | admin | set | github: 65098 |
| 2021年12月09日 00:15:16 | iritkatriel | set | status: open -> closed nosy: + iritkatriel messages: + msg408056 resolution: out of date stage: resolved |
| 2020年03月24日 16:05:14 | theller | set | nosy:
- theller |
| 2020年03月24日 15:54:23 | Jonathan Hsu | set | nosy:
+ Jonathan Hsu messages: + msg364937 |
| 2020年03月18日 18:42:16 | brett.cannon | set | nosy:
- brett.cannon |
| 2014年11月26日 11:53:21 | theller | set | nosy:
+ theller |
| 2014年11月25日 14:39:53 | brett.cannon | set | nosy:
+ twouters, gregory.p.smith |
| 2014年11月25日 09:09:40 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka versions: + Python 3.5, - Python 3.3 |
| 2014年03月13日 00:07:07 | pitrou | set | nosy:
+ brett.cannon, ncoghlan, eric.snow |
| 2014年03月12日 21:50:06 | eric.smith | set | nosy:
+ eric.smith |
| 2014年03月12日 20:33:52 | barry | set | nosy:
+ barry |
| 2014年03月12日 20:30:25 | Andrey.Antsut | create | |