[Python-Dev] zipimport & import hooks

Guido van Rossum guido@python.org
Fri, 06 Dec 2002 09:56:15 -0500


> Has anyone presented any hard data, or are people just guessing?

I found two uses in the Zope 3 codebase that would break for
non-strings.

            cwd = os.getcwd()
            for path in sys.path[1:]: # Yeah, we need to exclude the
            cwd itself
                if path != '' and cwd.startswith(path):
                    name = os.path.join(cwd[len(path)+1:], name)
                    name = os.path.normpath(name)
                    break

        d['PYTHONPATH'] = os.pathsep.join(sys.path)

    def getPythonPath(self):
        'See Zope.App.OFS.ApplicationControl.IRuntimeInfo.IRuntimeInfo'
        return tuple(sys.path)
    # The interface promises a tuple of strings

--Guido van Rossum (home page: http://www.python.org/~guido/)