On 4/30/07, Greg Ewing <[EMAIL PROTECTED]> wrote:
> JOSHUA ABRAHAM wrote:
> > I was hoping you guys would consider creating  function in os.path or
> > otherwise that would find the full path of a file when given only it's base
> > name and nothing else.I have been made to understand that this is not
> > currently possible.
>
> Does os.path.abspath() do what you want?
>
> If not, what exactly *do* you want?

probably:

def find_in_path(filename):
     for path in os.environ['PATH'].split(os.pathsep):
           if os.path.exists(filename):
                    return os.path.abspath(os.path.join(path, filename))

-Mike
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to