Using PyImport_ExtendInittab with package

Aahz aahz at
Tue Jan 5 02:36:52 CET 2010

In article <mailman.2093.1261160638.2873.python-list at>,
Julien Danjou  <julien at> wrote:
>I'm trying to embed Python and therefore use PyImport_ExtendInittab() to
>register modules.
>My current problem is that, if it works well with a simple module
>"hello", naming a module "hello.foobar" in the inittab struct does not
>seems to work.
>imp.find_module("hello.foobar") returns correctly that the module is
>found, but import hello.foobar fails badly.
>Is . notation supported in inittab? Am I doing something wrong?

This is probably wrong in some detail, but I think you need to import
each level of a package separately.  I.e. you need to import 'hello'
before you can import 'hello.foobar'.
Aahz (aahz at           <*>

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.

More information about the Python-list mailing list