[Python-Dev] module extension search order - can it be changed?
Guido van Rossum
guido@python.org
Tue, 25 Feb 2003 12:21:19 -0500
> >> This doesn't quite make sense to me. Instead of ".so cannot be
> >> built" did you mean ".so cannot be imported"?
>
> Guido> No, I meant what I said. Once the file is found, it will be
> Guido> tried and if that fails, the other files won't be tried. The
> Guido> idea was that if the .so cannot be built, it won't be installed
> Guido> -- but the .py will be there at all times.
>
> In which case there is no .so file to try to find, thus no "feature".
I'm not sure if you're stil objecting. The feature is that .so wins
over .py. I though I've explained clearly why this is a feature. If
not, please ask a more detailed question.
> >> In any case, the current solution to my underlying problem (so many
> >> failing stat() calls during module import) appears to be to create
> >> $prefix/python23.zip and populate it with the contents of the
> >> standard library using zipfile.PyZipFile.
>
> Guido> Right, that's what zipimport is for.
>
> Any thought about having the installation process create and populate
> python23.zip? It's not particularly hard. I'm willing to submit a patch
> for the build/install process.
python23.zip is good for end users of programs written in Python, but
not so good for Python programmers: AFAIK it won't show source lines
in tracebacks for modules loaded from the zip file.
So it should be an option. That said, I think it is a desirable
option.
--Guido van Rossum (home page: http://www.python.org/~guido/)