Re: os.mkdir and mode

2006-12-04 Thread Nick Craig-Wood
Martin v. Löwis <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood schrieb: > > So it looks like python mkdir() is applying the umask where as > > /bin/mkdir doesn't. From man 2 mkdir > > Actually, mkdir(1) has no chance to not apply the umask: it also > has to use mkdir(2), which is implemented in

Re: os.mkdir and mode

2006-12-04 Thread Nick Craig-Wood
Peter Otten <[EMAIL PROTECTED]> 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/adv

Re: os.mkdir and mode

2006-12-02 Thread Martin v. Löwis
Nick Craig-Wood schrieb: > So it looks like python mkdir() is applying the umask where as > /bin/mkdir doesn't. From man 2 mkdir Actually, mkdir(1) has no chance to not apply the umask: it also has to use mkdir(2), which is implemented in the OS kernel, and that applies the umask. Try strace mkd

Re: os.mkdir and mode

2006-12-02 Thread vj
> To fix your problem, reset your umask thus :- Thanks for the detailed reply. Your fix works like a charm. VJ -- http://mail.python.org/mailman/listinfo/python-list

Re: os.mkdir and mode

2006-12-02 Thread Peter Otten
Nick Craig-Wood wrote: > Peter Otten <[EMAIL PROTECTED]> 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

Re: os.mkdir and mode

2006-12-02 Thread Nick Craig-Wood
vj <[EMAIL PROTECTED]> 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. You mean :- $ python -c 'import os; os.mkdir("test", 0770)' $ stat test/ File: `test/' Size: 4096

Re: os.mkdir and mode

2006-12-02 Thread Nick Craig-Wood
Peter Otten <[EMAIL PROTECTED]> 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.pyth

Re: os.mkdir and mode

2006-12-02 Thread Peter Otten
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

Re: os.mkdir and mode

2006-12-01 Thread Godson
On 1 Dec 2006 23:17:50 -0800, vj <[EMAIL PROTECTED]> 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. Thanks, VJ -- http://mail.python.org/mailman/listinfo/python-list using os.mkd

os.mkdir and mode

2006-12-01 Thread vj
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. Thanks, VJ -- http://mail.python.org/mailman/listinfo/python-list