[Python-Dev] New relative import issue

Mark Hammond mhammond at skippinet.com.au
Fri Sep 22 04:29:45 CEST 2006

Guido writes:

> As Phillip understood, I meant the environment to include the
> filesystem (and on Windows, the registry -- in fact, Python on Windows
> *has* exactly such a mechanism in the registry, although I believe
> it's rarely used these days -- it was done by Mark Hammond to support
> COM servers I believe.)

It is rarely used these days due to the fact it is truly global to the
machine.  These days, it is not uncommon to have multiple copies of the same
Python version installed on the same box - generally installed privately
into an application by the vendor - eg, Komodo and Open Office both do this
to some degree.

The problem with a global registry is that *all* Python installations
honoured it.  This meant bugs in the vendor applications, as their 'import
foo' did *not* locate the foo module inside their directory, but instead
loaded a completely unrelated one, which promptly crashed.

A mechanism similar to .pth files, where the "declaration" of a module's
location is stored privately to the installation seems a more workable


More information about the Python-Dev mailing list