Developing modules with ‘pkgutil’

Peter Otten __peter__ at
Thu Apr 16 10:39:39 CEST 2009

Ben Finney wrote:

> At this point I'm stuck. I can't see how to have the
> ‘docutils/’ stop shadowing the names in the system-installed
> ‘docutils/’, while still doing the namespace shuffle
> necessary to have my in-development module appear part of the wider
> package namespace. What should I be doing instead?

Weird idea. Try putting the following in your files:

import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
import __init__

If that doesn't work add

import docutils
docutils.__path__.insert(0, path_to_modified_version)

to your main script. Repeat for every subpackage.


More information about the Python-list mailing list