sys.path[0] in IDLE

Lee Harr missive at frontiernet.net
Sun Dec 28 20:19:14 CET 2003


>>>Am I reading this correctly?
>>>
>>>http://python.org/doc/current/lib/module-sys.html
>>>
>>>"""
>>>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.
>>>"""
>>>
>>>
>>>So, sys.path[0] should be the directory that my script is in?
>
> Back in March 2003, I had the following exchange with Kurt Kaiser on the =
> Idle-dev list. This may clear things up for you.
>
> http://mail.python.org/pipermail/idle-dev/2003-March/001672.html
>


Thanks for the link.

Now I am thinking that using sys.argv[0] will be a better, more reliable,
way of finding where the running script is located.

Does that way have any pitfalls I should watch for?






More information about the Python-list mailing list