Package that imports with name of dependent package

David Pratt fairwinds at eastlink.ca
Sat May 13 12:34:22 EDT 2006


Hi Peter. I'd like to fix the imports, but this would impact the 
portability of portions of the code that currently work with the 
existing package from the framework.

This solution does the trick and allows me to create the package I want 
using a good amount of new material. I don't have to worry about adding 
to the original package each time a release comes out. I'll only have to 
monitor code changes for an impact on my classes, subclasses, etc. Still 
a pain, but a smaller one :-)  Many thanks.

Regards
David


Peter Otten wrote:
> from pkgutil import extend_path
> import mypackage
> __path__ = extend_path(mypackage.__path__, __name__)
> 
> into dependentpackage/__init__.py might work. 
> 
> Peter
> 
> 
> 



More information about the Python-list mailing list