weird problem with os.chmod

Mardy mardy78 at yahoo.it
Sat Nov 12 13:21:04 EST 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.


-- 
Saluti,
    Mardy
http://interlingua.altervista.org




More information about the Python-list mailing list