How can I check 4 readonly?

Roger Upole rupole at compaq.net
Thu Aug 3 18:25:29 EDT 2000


You can use win32file from the win32 extensions.
import win32file
fileatt = win32file.GetFileAttributes(filename)
print fileatt & win32file.FILE_ATTRIBUTE_READONLY

hth
Roger Upole

"Franz GEIGER" <fgeiger at datec.at> wrote in message
news:8mcbkg$klu$1 at pollux.ip-plus.net...
> I am desperatly trying to retrieve something like a readonly flag on
files.
> os.stat("file.txt")[ST_MODE] returns the value of st_mode, but there is no
> S_-function like S_ISDIR() to check for a readonly flag. O_RDONLY is only
> for opening() files (its value is 0). Any idea?
>
> Platform: Python 1.5.2 on NT4.
>
> Many thanks in advance and best regards
> Franz GEIGER
>
>
>





More information about the Python-list mailing list