[issue5586] The documentation of os.makedirs is misleading

2009-04-05 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Actually, it works as documented:

 import os
 os.makedirs(/tmp)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/os.py, line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/tmp'

--
resolution:  - works for me
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5586] The documentation of os.makedirs is misleading

2009-04-05 Thread Mher Movsisyan

Mher Movsisyan mher.movsis...@gmail.com added the comment:

Sorry for confusion. I thought a leaf directory is an intermediate-level 
directory.

 import os
 os.makedirs(/tmp/a/b)


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5586] The documentation of os.makedirs is misleading

2009-03-28 Thread Mher Movsisyan

New submission from Mher Movsisyan mher.movsis...@gmail.com:

The documentation of os.makedirs (http://docs.python.org/library/os.html?
highlight=makedirs#os.makedirs) is misleading. It states that os.makedirs 
raises an 
exception if the leaf directory already exists but it doesn't.

Lib/os.py:

136 def makedirs(name, mode=0777):
137 makedirs(path [, mode=0777])
138 
139 Super-mkdir; create a leaf directory and all intermediate ones.
140 Works like mkdir, except that any intermediate path segment (not
141 just the rightmost) will be created if it does not exist.  This is
142 recursive.
143 
144 
145 head, tail = path.split(name)
146 if not tail:
147 head, tail = path.split(head)
148 if head and tail and not path.exists(head):
149 try:
150 makedirs(head, mode)
151 except OSError, e:
152 # be happy if someone already created the path
153 if e.errno != errno.EEXIST:
154 raise
155 if tail == curdir:   # xxx/newdir/. exists if xxx/newdir 
exists
156 return
157 mkdir(name, mode)

The attachment is a patch of the documentation (trunk, revision 70643).

--
assignee: georg.brandl
components: Documentation
files: makedirs.diff
keywords: patch
messages: 84305
nosy: georg.brandl, mher
severity: normal
status: open
title: The documentation of os.makedirs is misleading
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file13439/makedirs.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5586
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com