ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: chmod g+ Equivalent
by Lawrence Oluyede other posts by this author
Aug 13 2007 4:36PM messages near this date
chmod g+ Equivalent | Re: chmod g+ Equivalent
milan_sanremo <hancock.robert@[...].com>  wrote:
>  I've read the documentation on os.chmod() and can implement all the
>  standard commands, but what is the syntax for the equivalent of chmod g
>  + to set the group id?

chmod() [1] takes as the second parameter a bitwise or-ed combination of
a series of values. If you look at chmod's man page ("man 2 chmod" on
the shell) you can see the following values for the group id (I have OSX
so the actual value may be different on your OS):

           #define S_IRWXG 0000070    /* RWX mask for group */
           #define S_IRGRP 0000040    /* R for group */
           #define S_IWGRP 0000020    /* W for group */
           #define S_IXGRP 0000010    /* X for group */

So you just have to OR them to accomplish your goal.  

1 - <http://docs.python.org/lib/os-file-dir.html#l2h-2677> 

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair
-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Milan_sanremo
Lawrence Oluyede
Milan_sanremo
Bjoern Schliessmann
Milan_sanremo

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved