At 12:25 AM 10/24/2006 +0200, Giovanni Bajo wrote:
Phillip J. Eby wrote:
If I'm reading it correctly, ihooks expects modules to be files, period. So it's not going to work with any zipfile, let alone eggs. The workaround would be to configure easy_install to --always-unzip when installing. See the manual for details.
Yes that's a workaround but I'd rather avoid it if possible.
(Note that ihooks predates PEP 302 and therefore does not support it. ihooks in fact *replaces* the built-in import mechanism entirely, so it's not likely to work correctly with any other PEP 302-based features besides eggs.)
I see. If you were to write the module I showed you, using a PEP-302 compatible system, what would you use? Is it possible to achieve the same thing in such few lines, but being PEP-302 compatible?
Not in just a few lines, no. It would take quite a few, I'm afraid. PEP 302 doesn't provide a filesystem abstraction, and isn't likely to grow one soon. Maybe by Python 2.6 or 3.0, depending on how much free time I end up getting in the next couple of years. :)