How do I find executable files from the environment PATH variable?

Martin v. Loewis martin at v.loewis.de
Tue Aug 6 11:01:19 CEST 2002


noah at noah.org (Noah) writes:

> Am I forced to check every directory in PATH 
> and test each one with os.access()? 

Yes, I think so.

> If so then will this script duplicate the actions of the shell in
> searching for an executable file?

On Unix, it will. On Windows, you have to take into account that a
number of registered extensions might get appended to the file names
(.bat, .exe, .com, etc.)

Regards,
Martin



More information about the Python-list mailing list