Hi all I have some problems to get the the permissions on windows. I use a simple code that run perfectly in UNIX but give me wrong information on Windows. I found this code searching by google:
import os import stat print os.stat('fichero.txt') st = os.stat('fichero.txt') mode = st[stat.ST_MODE] print mode if mode & stat.S_IREAD: # same as stat.S_IRUSR print "readable" if mode & stat.S_IWRITE: # same as stat.S_IWUSR print "writable" if mode & stat.S_IEXEC: # same as stat.S_IXUSR print "executable" This code allways say that file is readable and writable except if is a read only file. Looking for a solution I found this code that use other library but the result is the same: import nt import os import sys if (sys.platform == "win32"): print nt.access ('c:/prueba/fichero.txt', nt.W_OK) is there a solution for this?, another library or code? Anything that i do wrong? Thanks everybody. Best regards. -- http://mail.python.org/mailman/listinfo/python-list