Skip to content

Cryptic error when `time` is not installed

We can't rely on the shell's time utility, as we need more information.

When that fails, we'd end up with:

Traceback (most recent call last):                                                                                                                                                                         
  File "/codethink/GNOME/bst-benchmarks/benchmark.py", line 386, in <module>                                                                                                                               
    compare()
  File "/codethink/GNOME/bst-benchmarks/.tox/benchmark/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/codethink/GNOME/bst-benchmarks/.tox/benchmark/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/codethink/GNOME/bst-benchmarks/.tox/benchmark/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/codethink/GNOME/bst-benchmarks/.tox/benchmark/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/codethink/GNOME/bst-benchmarks/benchmark.py", line 360, in compare
    results = benchmark(loaded_config, get_commits, show_only=show_only)
  File "/codethink/GNOME/bst-benchmarks/benchmark.py", line 310, in benchmark
    cwd=PROJECT_PATH,
  File "/codethink/GNOME/bst-benchmarks/benchmark.py", line 160, in time_command
    env=environ,
  File "/codethink/GNOME/bst-benchmarks/benchmark.py", line 137, in run
    universal_newlines=True,
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1436, in _execute_child
    executable = os.fsencode(executable)
  File "/codethink/GNOME/bst-benchmarks/.tox/benchmark/lib/python3.7/os.py", line 809, in fsencode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType

We should have a better error reporting