[Python-Dev] zipimport & import hooks

Fredrik Lundh fredrik@pythonware.com
Fri, 6 Dec 2002 16:04:34 +0100


Guido wrote:

> > Has anyone presented any hard data, or are people just guessing?
>=20
> I found two uses in the Zope 3 codebase that would break for
> non-strings.
>=20
>             cwd =3D os.getcwd()
>             for path in sys.path[1:]: # Yeah, we need to exclude the =
cwd itself
>                 if path !=3D '' and cwd.startswith(path):
>                     name =3D os.path.join(cwd[len(path)+1:], name)
>                     name =3D os.path.normpath(name)
>                     break
>=20
>         d['PYTHONPATH'] =3D os.pathsep.join(sys.path)
>=20
>     def getPythonPath(self):
>         'See =
Zope.App.OFS.ApplicationControl.IRuntimeInfo.IRuntimeInfo'
>         return tuple(sys.path)
>     # The interface promises a tuple of strings

can Zope users modify the path?  (is this "application code", or is this
part of a package that can be used by applications other than the main
Zope programs?)

</F>