Xpra: Ticket #1182: which(pactl) fails with undescriptive error if /usr/bin/which is missing

My Xpra 0.17.0 server logs:

2016-04-20 17:15:02,175 which(pactl) error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/sound/pulseaudio/pulseaudio_pactl_util.py", line 23, in which
    returncode, out, _ = safe_exec(cmd, log_errors=False)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/exec_util.py", line 13, in safe_exec
    process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

From this output it is not clear which file is missing. Some investigation reveals that which itself is not installed.

It would be nice if Xpra would not rely on which or fail more gracefully to allow easier debugging.

Thu, 21 Apr 2016 12:27:18 GMT - Antoine Martin: owner changed

r12449 improves the error handling, the message should now look like this:

Error: failed to run 'which pactl'
 [Errno 2] No such file or directory

As for being able to detect if "pactl" is installed without trying to execute it, feel free to suggest a better option I can implement.

Tue, 09 Aug 2016 15:06:17 GMT - Antoine Martin: status changed; resolution set

Not heard back, closing.

Sat, 23 Jan 2021 05:17:12 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1182