Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well

        def mktree(newdir):
    """works the way a good mkdir should :)
        - already exists, silently complete
        - regular file in the way, raise an exception
        - parent directory(ies) does not exist, make them as well
    """
    if os.path.isdir(newdir):
        pass
    elif os.path.isfile(newdir):
        raise OSError("a file with the same name as the desired "
                      "dir, '%s', already exists." % newdir)
    else:
        os.makedirs(newdir)
        


src/d/j/django-webcam-HEAD/webcam/tests/__init__.py   django-webcam(Download)
from __future__ import absolute_import
import tempfile
 
from .util import mktree
from webcam.storage import CameraStorage
 
temp_storage_location = tempfile.mkdtemp(prefix='_webcam')
mktree(temp_storage_location)

src/d/j/django-webcam-0.1b1/webcam/tests/__init__.py   django-webcam(Download)
import tempfile
 
from .util import mktree
from webcam.storage import CameraStorage
 
temp_storage_location = tempfile.mkdtemp(prefix='_webcam')
mktree(temp_storage_location)