def chmod_plus_x(executable_path): current_st = os.stat(executable_path) os.chmod(executable_path, current_st.st_mode | stat.S_IEXEC)