def get_prefix(ctx, args, search=True):
 if getattr(args, u'name', None):
  if (u'/' in args.name):
   raise CondaValueError((u"'/' not allowed in environment name: %s" % args.name), getattr(args, u'json', False))
  if (args.name == ROOT_ENV_NAME):
   return ctx.root_dir
  if search:
   return locate_prefix_by_name(ctx, args.name)
  else:
   return join(ctx.envs_dirs[0], args.name)
 elif getattr(args, u'prefix', None):
  return abspath(expanduser(args.prefix))
 else:
  return ctx.default_prefix

def get_prefix ( ctx , args , search = True ) : if getattr ( args , u'name' , None ) : if ( u'/' in args . name ) : raise CondaValueError ( ( u"'/' not allowed in environment name: %s" % args . name ) , getattr ( args , u'json' , False ) ) if ( args . name == ROOT_ENV_NAME ) : return ctx . root_dir if search : return locate_prefix_by_name ( ctx , args . name ) else : return join ( ctx . envs_dirs [ 0 ] , args . name ) elif getattr ( args , u'prefix' , None ) : return abspath ( expanduser ( args . prefix ) ) else : return ctx . default_prefix
get the prefix to operate in args: ctx: the context of conda args: the argparse args from the command line search: whether search for prefix returns: the prefix raises: condaenvironmentnotfounderror if the prefix is invalid .