PyImport_ImportModule/embedding: surprising behaviors

Alex Martelli aleax at
Sat Mar 24 17:36:56 CET 2007

Aahz <aahz at> wrote:

> In article <mailman.5359.1174435375.32031.python-list at>,
> David Abrahams  <dave at> wrote:
> >
> >I was under the impression that both the current directory *and* the
> >python library directory were already, automatically, in sys.path, so
> >I'm really surprised to see this.  Am I doing something wrong, or is
> >this simply the expected behavior (and if so, where is it documented)?
> IIRC (without bother to test), there has been some change in the
> definition of "current directory" -- it used to be the actual current
> directory of os.getcwd(), but since changed to the startup directory.

In 2.3 and later, at least (sorry, no 2.2 and earlier around to check), makes every directory along sys.path an absolute path at Python
startup.  This _should_ probably be documented at
<>, but it doesn't appear to
be clearly stated there (the page only speaks of site's job of
"appending site specific paths", and not of the other jobs it also
performs, such as normalizing sys.path by turning all paths into
absolute ones and removing duplicates).


More information about the Python-list mailing list