On Wed, Oct 19, 2005 at 09:26:16AM -0700, Dr. Who wrote:
> The fact that the directory already exists is irrelevant to the function...it
> still failed to create the directory.
That's not true. Imagine that os.makedirs() is used inside tempfile.mkdtemp()
(I looked, and it isn't) and the proposed
Thomas Bellman wrote:
>try:
> os.makedirs("/tmp/trh/spam/norwegian/blue/parrot/cheese")
>except os.error, e:
> if e.errno != errno.EEXIST:
> raise
This is what i want. Thanks.
(the doc needs quite some improvement...)
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
-
I wrote:
>try:
> os.makedirs("/tmp/trh/spam/norwegian/blue/parrot/cheese")
>except os.error, e:
> if e.errno != errno.EEXIST:
> raise
Actually, when I think more about it, one would probably rather
want something like:
try:
os.makedirs("/tmp/trh/spam/nor
"Xah Lee" <[EMAIL PROTECTED]> wrote:
> The "Throws an error exception" should be "Throws an OSError
> exception".
Both are correct:
>>> os.error is OSError
True
That is even documented in http://python.org/doc/lib/module-os.html:
error
This exception is raised when a functi
if not os.path.isdir("your_dir_name"):
makedirs("your_dir_name")
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
> i think the function shouldn't complain if dir already exists. How is a
> programer to distinguish if the dir already exists, or if there's a
> problem creating the dir?
Of course it should thrown an exception because it was unable to do
what it was asked: create a directory. Th
if os.access( path, os.F_OK):
print 'path exists'
See also os.stat(path) for further info. about a file or dir.
regards, Paul Clinch
--
http://mail.python.org/mailman/listinfo/python-list
Python doc problem:
http://python.org/doc/2.4.2/lib/os-file-dir.html
makedirs( path[, mode])
Recursive directory creation function. Like mkdir(), but makes all
intermediate-level directories needed to contain the leaf directory.
Throws an error exception if the leaf directory already ex