skbio.util.
create_dir
(dir_name, fail_on_exist=False, handle_errors_externally=False)[source]¶Create a directory safely and fail meaningfully
State: Experimental as of 0.4.0.
Parameters: | dir_name: string
fail_on_exist: bool, optional
handle_errors_externally: bool, optional
|
---|---|
Returns: | return_value : int
|
Notes
Depending of how thorough we want to be we could add tests, e.g. for testing actual write permission in an existing dir.
Examples
>>> from skbio.util import create_dir
>>> from os.path import exists, join
>>> from tempfile import gettempdir
>>> from os import rmdir
>>> new_dir = join(gettempdir(), 'scikitbio')
>>> create_dir(new_dir)
0
>>> exists(new_dir)
True
>>> rmdir(new_dir)