[Tutor] set the mode of a file

orbitz at ezabel.com orbitz at ezabel.com
Mon Mar 1 18:31:15 EST 2004


Why not just use os.chmod?


On Mon, 01 Mar 2004 12:58:27 -0700
Stewart Midwinter <stewart at midtoad.homelinux.org> wrote:

> If you were wanting to do it from within your Python program, you could use
> the os.system() command.  If you want to check if the mode change was
> successful, you could monitor the return code from that command, by using
> os.popen2 or popen4, or even the new popen5 command. 
> 
> cheers
> 
> -- 
> Stewart Midwinter
> Calgary, Alberta
> stewart 'at' midwinter 'dot' ca
> 
> 
> Quoting hcohen2 <hcohen2 at comcast.net>:
> 
> > Kirk Bailey wrote:
> > 
> > > I want to set the mode of a text file to 666. How do I do it?
> > >
> > Assuming Linux/UNIX
> > 
> > $ chmod 666 <file name>   /* Means read write for file owner, group, 
> > public [i.e. any user] is that what you really want? */
> > 
> > Explanation: 4 - read, 2 - write and 1 - executable, I usually make mine 
> > 755 on this one user machine.
> > 
> > 
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> > 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list