def _open_library(config):
 dbpath = config['library'].as_filename()
 try:
  lib = library.Library(dbpath, config['directory'].as_filename(), get_path_formats(), get_replacements())
  lib.get_item(0)
 except (sqlite3.OperationalError, sqlite3.DatabaseError):
  log.debug(traceback.format_exc())
  raise UserError(u'database file {0} could not be opened'.format(util.displayable_path(dbpath)))
 log.debug(u'library database: {0}\nlibrary directory: {1}'.format(util.displayable_path(lib.path), util.displayable_path(lib.directory)))
 return lib

def _open_library ( config ) : dbpath = config [ 'library' ] . as_filename ( ) try : lib = library . Library ( dbpath , config [ 'directory' ] . as_filename ( ) , get_path_formats ( ) , get_replacements ( ) ) lib . get_item ( 0 ) except ( sqlite3 . OperationalError , sqlite3 . DatabaseError ) : log . debug ( traceback . format_exc ( ) ) raise UserError ( u'database file {0} could not be opened' . format ( util . displayable_path ( dbpath ) ) ) log . debug ( u'library database: {0}\nlibrary directory: {1}' . format ( util . displayable_path ( lib . path ) , util . displayable_path ( lib . directory ) ) ) return lib
create a new library instance from the configuration .