casm.api.casm_command

casm.api.casm_command(args, root=None, combine_output=False)[source]

Execute a command via the c api, writing output to stdout/stderr. If required by the specific command, a temporary PrimClex instance will be constrcuted. Use Project.command or Project.capture to avoid re-initializations.

Parameters
  • args (str) –

    A string containing the arguments for the casm command to be executed.

    Ex: “select –set-on -o /abspath/to/my_selection” Ex: “query -k ‘configname selected’ -v -o STDOUT”

  • root (str (optional, default=os.getcwd())) – A string giving the path to a root directory of a CASM project, typically casm.project.Project.path

  • combine_output (bool (optional, default=False)) – If True, print stdout and stderr to same str and only ret

Returns

returncode (The result of running the command via the command line iterface. ‘stdout’ and) – ‘stderr’ are in text type (‘unicode’/’str’).