[Python-bugs-list] [ python-Bugs-661136 ] zipimport does not accept nested pure python imports

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Jan 2003 07:54:17 -0800


Bugs item #661136, was opened at 2003-01-02 15:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661136&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Sandy Norton (sandynorton)
Assigned to: Nobody/Anonymous (nobody)
Summary: zipimport does not accept nested pure python imports

Initial Comment:
I presume this is a big with zipimport. It occurs when
you have a nested pure python package structure. It
doesn't occcur if there are byte-compiled versions in
the zipped directory.



as pure python zipped directory
===============================

Assume mylib.zip is inserted on the sys.path with the
following
directory structure:

mylib.zip
	mod.py
	p1
		__init__.py
		mod.py
		p2
			__init__.py
			mod.py

C:\TMP>ls
mylib.zip

C:\TMP>p
Python 2.3a1 (#38, Jan  1 2003, 16:44:16) [MSC v.1200
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sys; sys.path.insert(0, 'c:\tmp\mylib.zip')
>>> import mod
mod
>>> from p1 import mod
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError:
C:\Engines\python\dist\src\Objects\stringobject.c:3295:
bad argumen
t to internal function
>>> from p1.p2 import mod
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError:
C:\Engines\python\dist\src\Objects\stringobject.c:3295:
bad argumen
t to internal function
>>>

as plain directory
===================

C:\TMP>p
Python 2.3a1 (#38, Jan  1 2003, 16:44:16) [MSC v.1200
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sys
>>> sys.path.insert(0, 'c:\tmp\mylib')
>>> import mod
mod
>>> from p1 import mod
mod1
>>> from p1.p2 import mod
mod2
>>>

as byte-compiled zipped directory
=================================
mylib.zip
	mod.py
	mod.pyc
	p1
		__init__.py
		__init__.pyc
		mod.py
		mod.pyc
		p2
			__init__.py
			__init__.pyc
			mod.py
			mod.pyc

C:\TMP>p
Python 2.3a1 (#38, Jan  1 2003, 16:44:16) [MSC v.1200
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import sys; sys.path.insert(0, 'c:\tmp\mylib.zip')
>>> import mod
mod
>>> import p1.mod
mod1
>>> import p1.p2.mod
mod2
>>> p1.p2.mod
<module 'p1.p2.mod' from 'c:\tmp\mylib.zip\p1\p2\mod.pyc'>
>>>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661136&group_id=5470