Retrieving the full path of Unix apps

Andrew Dalke adalke at
Wed Oct 6 18:48:18 CEST 2004

Nick Craig-Wood wrote:
> def is_executable(filename):
>     return os.access(filename, os.X_OK)

Ahh.  Didn't know about 'access'.  Looks like I
could change

>>            if (os.path.exists(filename) and
>>                os.path.isfile(filename) and
>>                is_executable(filename)):


             if (os.access(filename, os.X_OK) and

because access returns false if the file/directory
doesn't exist.

				dalke at

More information about the Python-list mailing list