""" General helpers for my scripts """ import os from subprocess import call # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 __author__ = 'lanxu ' def is_exe(fpath): """ Tells if the given file is an executable """ return os.path.isfile(fpath) and os.access(fpath, os.X_OK) def run_command(command): """ Attempts to run the given command """ try: return_value = call(command) except (RuntimeError, TypeError, NameError, OSError) as error: raise return return_value