OT - file permission checks on Windows

Jason Orendorff jason at jorendorff.com
Mon Mar 4 23:52:45 EST 2002


Skip Montanaro wrote:
> Given this simple file access permission code: [...]
> how would I do this under Windows?

The following is not a joke.

Any Windows programmer would just "return 1".  It's not in
the Windows application development culture to care about
file permissions.  Besides, 98% of the time this is the
right answer on Windows.  Why write a bunch of messy Win32
API calls code going after the other 2%?

I think the typical thing is to just go ahead and try to
use the file.  If something goes wrong, pop up a message box
with a none-too-friendly error message.  ("Error - An error
has occurred." is about par for the course.)

Note that even on Unix, the code you quoted isn't perfect.
Users can belong to multiple groups these days.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list