Nested/Sub Extensions in Python

H Linux hartwig.linux at gmail.com
Sat Jul 2 15:35:19 CEST 2011


On Jul 2, 2:28 am, Carl Banks <pavlovevide... at gmail.com> wrote:
> 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.
Thanks for your help, but I actually tried both ways. This does not
seem to be the problem, as it fails both ways with identical error
message.

> What does the installed file layout look like after running distutils setup?
Tree output is:
/usr/local/lib/python2.6/dist-packages/
├── foo.so
├── smt
│   ├── bar.so
│   ├── __init__.py
│   └── __init__.pyc
└── smt-0.1.egg-info

Just in case anyone is willing to have a look, here is a link to the
complete module as built with:
python setup.py sdist:
https://docs.google.com/leaf?id=0Byt62fSE5VC5NTgxOTFkYzQtNzI3NC00OTUzLWI1NzMtNmJjN2E0ZTViZTJi&hl=en_US

If anyone has any other ideas how to get it to work, thanks in
advance...
Hartwig





More information about the Python-list mailing list