sys.path and os.chdir

James Kew james.kew at btinternet.com
Wed Aug 21 14:28:09 EDT 2002


"Anton Vredegoor" <anton at vredegoor.doge.nl> wrote in message
news:ak855u$n5l$1 at news.hccnet.nl...
> On 23 Aug 2002 06:22:59 -0700, Ugo_DiGirolamo at InVision.iip.com (ugodiggi)

> However, the unofficial interpretation of sys.path[0] is that it is the
> directory the script is started from.

http://www.python.org/doc/current/lib/module-sys.html sounds quite official
about this to me:

"The first item of this list, path[0], is the directory containing the
script that was used to invoke the Python interpreter. If the script
directory is not available (e.g. if the interpreter is invoked interactively
or if the script is read from standard input), path[0] is the empty string,
which directs Python to search modules in the current directory first."

James






More information about the Python-list mailing list