Terry J. Reedy added the comment:
This issue was really two issues: fix doc of existing behavior; change behavior
(which would be an enhancement). The first has been done; the second not. I
think this should be closed and if anyone still proposes the second, open a new
enhancement issue
Bonifacio added the comment:
I just read this issue's history and it looks like it is out of date. The docs
now match the behaviour.
> If the file exists but the mode is different than that specified (or
> defaulted) after applying the umask, then an error is raised regardless of
> the
Hynek Schlawack added the comment:
As announced, I hereby present an idea how to solve this problem for 3.4.
Please have a look at it. :)
--
assignee: docs@python -
versions: -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file27683/makedirs-on_wrong_mode-1.diff
Hynek Schlawack added the comment:
Let's get this rolling again. First let's fix the docs for 3.2+ first. My
current suggestion would be the following:
~~~
.. function:: makedirs(path, mode=0o777, exist_ok=False)
.. index::
single: directory; creating
single: UNC paths; and
R. David Murray added the comment:
Looks good to me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Python-bugs-list mailing list
Aditya Kedia added the comment:
Right.. Looks good.
--
nosy: +TheAdityaKedia
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Roundup Robot added the comment:
New changeset 88a7b9c3b6c0 by Hynek Schlawack in branch '3.2':
#13498: Clarify docs of os.makedirs()'s exist_ok argument.
http://hg.python.org/cpython/rev/88a7b9c3b6c0
--
nosy: +python-dev
___
Python tracker
Hynek Schlawack added the comment:
Ok, let’s do it here, that’s easier:
.. function:: makedirs(path, mode=0o777, exist_ok=False)
.. index::
single: directory; creating
single: UNC paths; and os.makedirs()
Recursive directory creation function. Like :func:`mkdir`, but makes
R. David Murray added the comment:
This is much better. But let me try tuning the problem paragraph a bit, since
I'm a native English speaker:
If *exists_ok* is ``False`` (the default), an :exc:`OSError` is raised if
the target directory already exists. If *exists_ok* is ``True`` an
Hynek Schlawack added the comment:
Silence means consent, so I will supply a patch as soon as 3.4 is open.
Meanwhile, I reworded the docs for os.makedirs, the patch is attached. Please
have a look at it so we can get it in for 3.3.
--
keywords: +patch
stage: needs patch - patch review
R. David Murray added the comment:
Silence doesn't mean consent, but it does mean you can go ahead and see if
anyone complains :)
I think your proposal is fine, but I'd prefer making the sentinels just
IGNORE and FAIL. The module namespace means the names themselves don't
have to be fully
Hynek Schlawack added the comment:
Silence doesn't mean consent, but it does mean you can go ahead and see if
anyone complains :)
Well that's what I meant. :)
I think your proposal is fine, but I'd prefer making the sentinels just
IGNORE and FAIL. The module namespace means the names
R. David Murray added the comment:
English-wise I would drop the Also.
You say differs from the one supplied, but given the rest of the text I would
expect that it is really differs from the supplied mode masked with the
current umask, on systems where the mode is respected, which is a
Hynek Schlawack added the comment:
How about something along of:
new arg on_wrong_perm=
1. WRONG_PERM_IGNORE
2. WRONG_PERM_FAIL
3. callable that gets called with the directory name and maybe the existing
perms to save stat call_
?
--
___
Python
Hynek Schlawack added the comment:
do you want it by default or a new flag? default sounds like a source for
obscure bugs to me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
R. David Murray added the comment:
I *want* it to be the default, since I think that is the typical use case, but
the existing default behavior means that such a backward incompatible change
would not be acceptable for exactly the reason you state. So yes, I want it as
a new flag.
R. David Murray added the comment:
I want the opposite: a way to say I don't care what the mode is as long as it
exists. Currently there is no way to do that, as far as I remember.
--
___
Python tracker rep...@bugs.python.org
Hynek Schlawack added the comment:
So, IMHO if someone calls os.makedirs with a mode != 0o777, they expect to have
the directories having those modes afterward. So raising no error if they exist
and have the wrong mode would be a plain bug.
Python 3.3 already has a helpful error message:
Changes by Dougal Matthews douga...@gmail.com:
--
nosy: +d0ugal
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Python-bugs-list
Changes by Axel Wegen axel.we...@googlemail.com:
--
nosy: +Axel.Wegen
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Python-bugs-list
Changes by Hynek Schlawack h...@ox.cx:
--
nosy: +hynek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Python-bugs-list mailing list
Johannes Kolb johannes.k...@gmx.net added the comment:
I want to mention a situation in which the current behaviour of os.makedirs is
confusing. At the first glance I would expect that if
os.makedirs(path)
succeeds, then a following call to
os.makedirs(path, exist_ok=True)
will succeed too.
Changes by Laurent Mazuel laurent.maz...@gmail.com:
--
nosy: +Laurent.Mazuel
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13498
___
___
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +Arfrever, belopolsky, draghuram, eric.araujo, gagenellina, georg.brandl,
giampaolo.rodola, ijmorlan, terry.reedy, ysj.ray, zooko
___
Python tracker rep...@bugs.python.org
New submission from R. David Murray rdmur...@bitdance.com:
The documentation for os.makedirs says:
If the target directory with the same mode as specified already exists,
raises an OSError exception if exist_ok is False, otherwise no exception is
raised.
This is not correct. If the file
25 matches
Mail list logo