Extending Python dynamically

Németh Miklós nemeth at iqsoft.hu
Thu Nov 4 16:05:57 EST 1999


Robin Dunn wrote:

> > Thank you for your help. The method you suggested works perfectly!
> > However, I do not understand completely how the Python interpreter finds
> out
> > that it has to load an so file. Normally -- I believed -- when Python sees
> an
> > "import xxx" statement it looks for a xxx.py, xxx.pyc or xxx.pyo file in
> the
> > $PYTHONPATH directories or an xxx subdirectory having an __init__.py file,
> but
> > not an xxx.so file. This means that if I add the current directory to the
> > $PYTHONPATH (such as export PYTHONPATH='.' Python will find any arbitrary
> so
> > file in the $PWD?
>
> It will also load xxxmodule.so as well, but .so files only get imported if
> they have an initxxx() function.
>
> --
> Robin Dunn
> Software Craftsman
> robin at AllDunn.com
> http://AllDunn.com/robin/
> http://AllDunn.com/wxPython/  Check it out!

Robin, you are a Genius!  Neither the "Python Reference Manual Release
1.5.2's
section 6.11 "The import statement" nor the Extending and Embedding the
Python
Interpreter documents explain this behaviour of the Python interpreter.
That is
why I felt myself a bit lost.
But now with Your help, I feel I know "everithing" ;-) about Python
extensibility.
I am also very happy with this mailing list (another very good ones
where I am a member are Qt's, LyX's, Apache-SSL's, etc lists). Within
some hours I got all the
support I needed -- no commercial mega-corporations are able to provide
such a quality
support even for tons of money.  I remember when I spent three weeks
with MS
Visual J++ 6.0 and no one could answer my simplest questions: that was
my last
attemp to fight with a proprietary (especially MS) development tool.

Thanks again!

NM





More information about the Python-list mailing list