os.mkdir and mode

Nick Craig-Wood nick at craig-wood.com
Mon Dec 4 06:30:04 EST 2006


Peter Otten <__peter__ at web.de> wrote:
> >>  "Where it is used, the current umask value is first masked out."
> >> 
> >>  Use os.chmod() after os.mkdir() to get the desired permissions.
> > 
> > I think you meant use os.umask(0) before the os.mkdir() ?
> 
>  No, I didn't. What is the difference/advantage of that approach?

If you use use os.umask(0) then the os.mkdir(dir, perms) will create
the directory with exactly those permissions, no chmod needed.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list