in google_cloud_automlops/utils/utils.py [0:0]
def write_and_chmod(filepath: str, text: str):
"""Writes a file at the specified path and chmods the file to allow for execution.
Args:
filepath (str): Path to the file.
text (str): Text to be written to file.
Raises:
Exception: An error is encountered while chmod-ing the file.
"""
write_file(filepath, text, 'w')
try:
st = os.stat(filepath)
os.chmod(filepath, st.st_mode | 0o111)
except OSError as err:
raise OSError(f'Error chmod-ing file. {err}') from err