[Python-Dev] zipimport & import hooks

M.-A. Lemburg mal@lemburg.com
Fri, 06 Dec 2002 16:54:42 +0100


Fredrik Lundh wrote:
> Just van Rossum wrote:
> 
> 
>>It seems the majority doesn't like non-strings on sys.path, which to me is
>>understandable, especially if you take PYTHONPATH into consideration. Let's try
>>to focus on that.
> 
> Has anyone presented any hard data, or are people just guessing?  As far
> as I can tell, I'm the only one here who has posted fragile code from a real
> shipping product -- and I still believe it's a bogus argument.

Have a look at distutils/command/install.py for an example:

         sys_path = map(os.path.normpath, sys.path)
         sys_path = map(os.path.normcase, sys_path)
         install_lib = os.path.normcase(os.path.normpath(self.install_lib))
         if (self.warn_dir and
             not (self.path_file and self.install_path_file) and
             install_lib not in sys_path):
             self.warn(("modules installed to '%s', which is not in " +
                        "Python's module search path (sys.path) -- " +
                        "you'll have to change the search path yourself") %
                       self.install_lib)

Most code we use is of the form:

	sys.path.append('dir')
	sys.path.insert(0, 'dir')
	sys.path = ['/usr/lib/python1.5/site-packages'] + sys.path

How I wish that we had some kind of code base archive for
third party code... e.g. the compile farm would probably be
great for this.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/