[Distutils] problems with namespace package

Tres Seaver tseaver at palladion.com
Sat May 1 19:24:09 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manlio Perillo wrote:
> Hi.
> 
> I have a package named A, with a subpackage B, and I want to create a
> namespace package A.B.C.

In your examples, it seems as though you want 'A' and 'A.B' to be
namespace packages, but 'A.B.C' is a "normal" package.

> In the namespace package setup file I set
>   namespace_packages=['A', 'A.B'],
> 
> and I use declare_namespace in both A/__init__.py and A/B/__init__.py
> modules.

Are you sure there is no other code in 'A/__init__.py' and
'A/B/__init__.py' of either package? See:

 http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages

> However if I:
> 1) install A package
> 2) install A.B.C package
> 
> importing A.B.C will raise an ImportError exception.
> 
> If I reinstall A package, then it seems to work.
> 
> Where is the problem?

You might compare your setup.py and __init__.py with those in one of the
'zope.app' packages, which successfully use nested namespace packages.
E.g. for zope.app.annotation:

http://svn.zope.org/repos/main/zope.app.annotation/trunk/setup.py
 http://svn.zope.org/repos/main/zope.app.annotation/trunk/src/zope/__init__.py

http://svn.zope.org/repos/main/zope.app.annotation/trunk/src/zope/app/__init__.py


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkvcY7kACgkQ+gerLs4ltQ7c7wCgp3P40zxnfYDK4p+if1FaP9Fo
wgsAn0ud53So7Xkk7U/BbDphYergXNjy
=+0mW
-----END PGP SIGNATURE-----



More information about the Distutils-SIG mailing list