(directory)
return True
Create the specified directory, if necessary.

    :param str directory: The directory to use.
    :rtype: bool
    :returns: True if no errors occurred and the directory was created or
              existed beforehand, False otherwise.
Create the specified directory, if necessary.
Create the specified directory if necessary .
def _create_if_necessary(directory):
    """Create the specified directory, if necessary.

    :param str directory: The directory to use.
    :rtype: bool
    :returns: True if no errors occurred and the directory was created or
              existed beforehand, False otherwise.
    """

    if not os.path.isabs(directory):
        log.debug("Got non-absolute path: %s" % directory)
        directory = os.path.abspath(directory)

    if not os.path.isdir(directory):
        log.info("Creating directory: %s" % directory)
        try:
            os.makedirs(directory, 0x1C0)
        except OSError as ose:
            log.error(ose, exc_info=1)
            return False
        else:
            log.debug("Created directory.")
    return True
def _create_if_necessary ( directory ) : if not os . path . isabs ( directory ) : log . debug ( "Got non-absolute path: %s" % directory ) directory = os . path . abspath ( directory ) if not os . path . isdir ( directory ) : log . info ( "Creating directory: %s" % directory ) try : os . makedirs ( directory , 0x1C0 ) except OSError as ose : log . error ( ose , exc_info = 1 ) return False else : log . debug ( "Created directory." ) return True