[Python-Dev] (no subject)
Mike Klaas
mike.klaas at gmail.com
Tue May 1 06:49:48 CEST 2007
On 4/30/07, Greg Ewing <greg.ewing at canterbury.ac.nz> 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
More information about the Python-Dev
mailing list