Possible bug in setting Windows file permissions? (os.chmod() not working properly?)

Gus Tabares gus.tabares at verizon.net
Mon Jun 16 19:29:48 EDT 2003


Matt,

	I do believe os.O_RDWR is specifically for the open() function. Check out
the bottom of this page:
http://www.python.org/doc/current/lib/os-fd-ops.html



HTH,
Gus

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Matt Shomphe
Sent: Monday, June 16, 2003 7:18 PM
To: python-list at python.org
Subject: Possible bug in setting Windows file permissions? (os.chmod()
not working properly?)


I noticed an error when trying to change the file permissions for a
file on a Windows (2K) machine.  I'm using David Beazley's excellent
"Python Essential Reference, 2nd. Ed." as a reference.  According to
the book (p. 186 for those following along at home), it should be used
thusly:

import os
os.chmod('myReadOnlyFile.txt', os.O_RDWR)


Where for os.O_RDWR, you could have any of the modes specified on p.
184.  In other words, all the same bitwise-or modes for opening a
file.  What happens with the above code is: nothing at all.  However,
the following code *will* work to change a file to be accessible:

import os
os.chmod('myReadOnlyFile.txt', 33206)

So, either I am using the os.chmod() function incorrectly, or there is
something wrong elsewhere.

Any hints on what's to be done?

M@
--
http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list