Retrieving the full path of Unix apps
Andrew Dalke
adalke at mindspring.com
Wed Oct 6 12:48:18 EDT 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)):
into
if (os.access(filename, os.X_OK) and
os.path.isfile(filename)):
because access returns false if the file/directory
doesn't exist.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list