Reading the access attributes of directories in Windows

Tim Golden mail at timgolden.me.uk
Fri Aug 20 13:42:08 EDT 2010


On 20/08/2010 5:10 PM, vsoler wrote:
> On Aug 20, 5:10 pm, Tim Golden<m... at timgolden.me.uk>  wrote:
>> To decode the permission bit-strings to vaguely meaningful
>> names:
>>
>> <code>
>> import os, sys
>> from winsys import fs
>>
>> dacl = fs.file (sys.executable).security ().dacl
>> for permission in dacl:
>>     print (d.trustee, " (Inherited )" if d.inherited else "")
>>     for name in fs.FILE_ACCESS.names_from_value (d.access):
>>       print ("  ", name)
>>
>> </code>
>>
>> TJG
>
> it seems as though the definition of "d" is missing in your last piece
> of code


Whoops, changed tack mid-thingy. Try:

dacl = ...
for d in dacl:
   # .. as before



More information about the Python-list mailing list