#!/usr/bin/env python import subprocess, sys print(sys.version) try: subprocess.call(['blahblahblah']) except FileNotFoundError as e: print(e.filename) # should be blahblahblah print(e.strerror)