Platform-dependent module search order?

Carsten Haese carsten at uniqsys.com
Sat Apr 28 22:03:03 EDT 2007


On Sat, 2007-04-28 at 14:54 -0700, John Machin wrote:
> Very interesting. My first reaction to Theo's posting was to make a
> confident declaration like Carsten did, but I couldn't simulate this
> behaviour on Windows with Python 2.5.1 (or 2.1.3 for that matter) and
> moreover the docs say:
> """
> Details of the module searching and loading process are implementation
> and platform specific. It generally involves searching for a ``built-
> in'' module with the given name and then searching a list of locations
> given as sys.path.

My "confident declaration" was a lucky guess based on the available
evidence. You couldn't reproduce the OP's problem because array is a
built-in module on Windows, but on Linux it's an external module:

Python 2.5 (r25:51908, Oct 28 2006, 12:26:14) 
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import array
>>> array
<module 'array' from '/usr/local/lib/python2.5/lib-dynload/array.so'>

-Carsten





More information about the Python-list mailing list