[Baypiggies] Locating the directory you are executing from

Aahz aahz at pythoncraft.com
Wed May 7 19:34:56 CEST 2008


On Wed, May 07, 2008, Daryl Spitzer wrote:
> On Wed, May 7, 2008 at 8:17 AM, Aahz <aahz at pythoncraft.com> wrote:
>> On Wed, May 07, 2008, Shannon -jj Behrens wrote:
>>>
>>> Furthermore, if you run your script like "$ script.py", and it runs
>>> because "." is in $PATH, I'm guessing that argv[0] won't have the full
>>> path, but __file__ will.  (By the way, "." is not in my path.)
>>
>>  <shudder>  ...and "." never should be on the path.
>
> I don't put "." on the path either, but I'm curious why you use the
> word "never".  (I guess I haven't learned why the hard way.)

First of all, please do not top-post:

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

As for your question, I assume that you wanted it sent to the group; I
don't answer private questions, generally speaking:

http://www.faqs.org/faqs/unix-faq/faq/part2/section-13.html
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Help a hearing-impaired person: http://rule6.info/hearing.html


More information about the Baypiggies mailing list