Can you rewrite the line as `subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).rstrip()`