__import__ confusion

Leazen leazen at uol.com.ar
Fri Feb 28 00:37:52 CET 2003


 I have finally finished the functions to import any available module in
a given directory.
 I attached them for anyone who would like to see them. Any comments are
welcome.
 Thanks Steven for all the fish ejem help.

Leazen

PS: AFAICS, imp.load_module does not create the __file__ and __path__
attributes. Am I mistaken? Why is this so?


Steven Taschuk wrote:
> 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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cargador.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20030227/a1317f08/attachment.ksh>


More information about the Python-list mailing list