Nested/Sub Extensions in Python

Carl Banks pavlovevidence at gmail.com
Fri Jul 1 20:28:29 EDT 2011


On Friday, July 1, 2011 1:02:15 PM UTC-7, H Linux wrote:
> Once I try to nest this, I cannot get the module to load anymore:
> >import smt.bar
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named bar

[snip]

> PyMODINIT_FUNC
> initbar(void)
> {
> 	Py_InitModule("smt.bar", bar_methods);
> }

This should be: Py_InitModule("bar", bar_methods);

That's probably it; other than that, it looks like you did everything right.  What does the installed file layout look like after running distutils setup?


Carl Banks




More information about the Python-list mailing list