pyjob.cexec module

pyjob.cexec.cexec(cmd, permit_nonzero=False, **kwargs)[source]

Function to execute a command

Parameters:
  • cmd (list) – The command to call
  • permit_nonzero (bool, optional) – Allow non-zero return codes [default: False]
  • **kwargs (dict, option) – Any keyword arguments accepted by Popen
Returns:

The processes’ standard out

Return type:

str

Raises:
  • PyJobExecutableNotFoundError – Cannot find executable
  • PyJobExecutionError – Execution exited with non-zero return code
pyjob.cexec.is_exe(fpath)[source]

Status to indicate if a file is an executable

Parameters:fpath (str) – The path to the file to be tested
Returns:
Return type:bool
pyjob.cexec.which(executable)[source]

Python-based mirror of UNIX which command

Parameters:executable (str) – The path or name for an executable
Returns:
  • str – The absolute path to the executable, or None if not found
  • Credits
  • ——-
  • https (//stackoverflow.com/a/377028/3046533)