Path problem
Lars Yencken
lljy at internode.on.net
Mon Dec 13 19:09:07 EST 2004
On 13/12/2004, at 6:39 PM, Binu K S wrote:
> sys.path[0] will contain the path to the script.
>
> From the sys module documentation:
> "As initialized upon program startup, 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.
> Notice that the script directory is inserted before the entries
> inserted as a result of PYTHONPATH."
Thanks, that's very helpful!!! That's fixed up a lot of scripts of mine
already, since many rely on an additional R script.
As to finding the path to my project root, I've managed to get the
other pathconf module going. Yay!
Thanks Binu and Limodou for your help.
Lars
More information about the Python-list
mailing list