weird problem with os.chmod

Mardy mardy78 at
Sat Nov 12 19:21:04 CET 2005

On Fri, 11 Nov 2005 16:49:23 -0800, James Colannino wrote:
> Ok, so now I have a very interesting problem, this time related to 
> os.chmod.  I have the following in a text file: 0600.  My script reads 
> that number as a string and converts it to an integer for use with 
> chmod.  However, when I do this, instead of the rw------ permissions 

0600 is the octal representation of 384. "man chmod" should help you.
Just use
   perm = int(string, 8)
instead of
   perm = int(string)
when converting to int the string you read from the file.


More information about the Python-list mailing list