os.mkdir and mode
Peter Otten
__peter__ at web.de
Sat Dec 2 05:47:50 EST 2006
Nick Craig-Wood wrote:
> Peter Otten <__peter__ at web.de> wrote:
>> vj wrote:
>>
>> > How do I do the following unix command:
>> >
>> > mkdir -m770 test
>> >
>> > with the os.mkdir command. Using os.mkdir(mode=0770) ends with the
>> > incorrect permissions.
>>
>> mkdir() works just like its C equivalent, see
>> http://docs.python.org/dev/lib/os-file-dir.html:
>>
>> "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?
Peter
More information about the Python-list
mailing list