Function for the path of the script?

Grant Edwards invalid at invalid.invalid
Mon Oct 28 10:49:56 EDT 2013


On 2013-10-27, Chris Angelico <rosuav at gmail.com> wrote:
> On Sun, Oct 27, 2013 at 1:52 PM, Gary Herron
><gary.herron at islandtraining.com> wrote:

>> Huh?  In what kind of a workflow are you running a python file without
>> knowing *what* file you are runnung?

I've been writing Python programs for 10+ years.  Never have I felt a
need to know the location of the file that's running.  I do sometimes
want to know the _name_ of the file (for multipurpose programs), but I
don't ever remember caring where that file was.

> It's very common to want to know what directory you're in - it's a
> good way to find data files.

>From a Unix point of view, that's also very wrong.  Data files don't
belong in the same directory as the executable.

-- 
Grant Edwards               grant.b.edwards        Yow! Is this an out-take
                                  at               from the "BRADY BUNCH"?
                              gmail.com            



More information about the Python-list mailing list