Why no isexec, isread, iswrite, etc (was: I must be missing something obvious: os.path.isexecutable?)

Grant Edwards grante at visi.com
Fri Jan 19 16:51:55 EST 2001


In article <slrn96hcek.mqj.grey at teleute.dmiyu.org>, Steve Lamb wrote:

>>[Same answer if you're going to try to write or exec a file.]
>
>    It is?  

I didn't say it was a _good_ answer.  ;)

>  What if you want to check to ensure something is executable before
>actually symlinking as a sanity check?

That's the problem with the "standard answer": there are times
that you want to check to see if something is XXXX-able without
actually doing XXXX because doing XXXX might have some nasty
side-effects. You just want to do the best you can to insure
that at the appropriate time (at which point there might not be
anybody around to see the error message), doing XXXX will work.

Your example is a good one: you want to check that a script is
executable so that you can change/modify configuration info,
but actually exec'ing the script would be a bad thing.

-- 
Grant Edwards                   grante             Yow!  I am a traffic light,
                                  at               and Alan Ginzberg kidnapped
                               visi.com            my laundry in 1927!



More information about the Python-list mailing list