This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 vstinner
收信人 desrt, georg.brandl, larry, ned.deily, pitrou, terry.reedy, vstinner
日期 2014-03-28.10:26:38
SpamBayes Score -1.0
Marked as misclassified
Message-id <CAMpsgwYY-a+OLu=1YQxz2L0DVCwBBp1qa17+kxFHjAVM52v1og@mail.gmail.com>
In-reply-to <1396000125.9.0.792543607071.issue21082@psf.upfronthosting.co.za>
内容
> I think the behaviour that an error is raised if the permissions are not the same is a nuisance that does not correspond to actual use cases (*).

I was also surprised that makedirs() checks for the exact permission.

We can probably document that makedirs(exists_ok=True) leaves the
directory permission unchanged if the directory already exist, and
that an explicit chmod() may be needed to ensure that permissions are
the expected permissions.

If the check on permissions is removed, an enhancement would be to
return a flag to indicate if at least one directory of the path
already existed. So the caller can avoid calling chmod() if all
directories of the path had to be created.

Something like:

if makedirs("a/b", mod=0o755, exists_ok=True):
  os.chmod("a", 0o755)
  os.chmod("a/b", 0o755)
# else a and b were created with the permission 0o755
历史
日期 用户 动作 参数
2014-03-28 10:26:39vstinner修改recipients: + vstinner, georg.brandl, terry.reedy, pitrou, larry, ned.deily, desrt
2014-03-28 10:26:39vstinner链接issue21082 messages
2014-03-28 10:26:38vstinner创建