remove read only flag

Tim Peters tim.one at comcast.net
Thu May 2 21:06:46 EDT 2002


[Cliff Wells]
> ...
> I'm not sure how the Unix permission scheme is mapped onto
> the Windows scheme.  I suppose if I had any sort of initiative I'd
> look in Python's platform-specific files and find out ;)

I'll save you the effort:  Python calls the platform C library's chmod()
regardless of platform.  Microsoft doesn't document what their chmod() does,
so I'll do it for them:  it looks at bit 0200 of the mode mask ("the owner
write bit"), and that's all.  If it's set, it tries to clear the Win32
FILE_ATTRIBUTE_READONLY attribute via the Win32 SetFileAttributes(); if 0200
is clear, it tries to set FILE_ATTRIBUTE_READONLY.

A more interesting question is how to map the Win2K permission scheme onto
anything <wink>.






More information about the Python-list mailing list