def run_command(args, rc): from . import global_logger if args.test_library: rc.set_lirbary_database('test') try: from ambry.library import global_library, Library global global_library l = Library(rc, echo=args.echo) global_library = l l.logger = global_logger l.sync_config() except Exception as e: if args.subcommand != 'info': warn('Failed to instantiate library: {}'.format(e)) l = None if args.exceptions: raise try: globals()['root_' + args.subcommand](args, l, rc) except NotFoundError as e: if args.exceptions: raise fatal(e) except Exception: raise