Hello,
i try to check, if a file on network-share is read only. I tried
different ways.
filename = r'//server/share/filename.txt'
1:
import win32api, win32con
fileAtt = win32api.GetFileAttributes(filename)
if (fileAtt & win32con.FILE_ATTRIBUTE_READONLY):
print("READONLY")
2:
import os, stat
fileAtt = os.stat(filename)[0]
if (not fileAtt & stat.S_IWRITE):
print("READONLY")
3:
import os
if not os.access(filename, os.W_OK):
print("READONLY")
all variants give me same result, that file is NOT readonly, but in real
it is.
The network-share is a Samba-Service with share-option "read only = yes"
i also tried to set "read only"-Flag in windows and copy this file to
network share.
Is there a solution, to find out, if my file is writeable or not?
Regards,
Steffen
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32