Using PyImport_ExtendInittab with package

Aahz aahz at pythoncraft.com
Mon Jan 4 20:36:52 EST 2010


In article <mailman.2093.1261160638.2873.python-list at python.org>,
Julien Danjou  <julien at danjou.info> 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 pythoncraft.com)           <*>         http://www.pythoncraft.com/

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