speechbrain.utils.superpowers module

Superpowers which should be rarely used.

This library contains functions for importing python classes and for running shell commands. Remember, with great power comes great responsibility.

Authors
  • Mirco Ravanelli 2020

Summary

Functions:

run_shell

This function can be used to run a command in the bash shell.

Reference

speechbrain.utils.superpowers.run_shell(cmd)[source]

This function can be used to run a command in the bash shell.

Parameters

cmd (str) – Shell command to run.

Returns

  • bytes – The captured standard output.

  • bytes – The captured standard error.

  • int – The returncode.

Raises

OSError – If returncode is not 0, i.e., command failed.

Example

>>> out, err, code = run_shell("echo 'hello world'")
>>> out.decode("utf-8")
'hello world\n'