__import__ confusion

Steven Taschuk staschuk at telusplanet.net
Wed Feb 26 22:56:05 CET 2003

Quoth Leazen:
> Steven Taschuk wrote:
> > Some caveats:
> >     - The loader should look for *.pyc and *.pyo files too.  Maybe even
> >       *.so files.
> >     - There's no support for package structures in the plugin directory.
> Thank you for this excelent reply!
> 	- '.so' files? As in shared libraries?

Yes; I'm imagining that a plugin might be provided as an
extension.  Depending on your application, it might not be
worthwhile spending any time thinking about this possibility.

(In fact, the loader should probably use the data in
imp.get_suffixes() rather than a hard-coded file name pattern.)

> 	- I would need to load a package structure a node at a time. I think I
> can use the module.__path__ attribute to get the path for each node.

Indeed.  The documentation for the imp module discusses this
recursive technique.

Steven Taschuk                          staschuk at telusplanet.net
"Its force is immeasurable.  Even Computer cannot determine it."
                            -- _Space: 1999_ episode "Black Sun"

More information about the Python-list mailing list