diff --git a/sdks/python/apache_beam/runners/portability/prism_runner.py b/sdks/python/apache_beam/runners/portability/prism_runner.py index 14854ca14a36..6a6e7d6d9a49 100644 --- a/sdks/python/apache_beam/runners/portability/prism_runner.py +++ b/sdks/python/apache_beam/runners/portability/prism_runner.py @@ -181,8 +181,13 @@ def _prepare_executable( _LOGGER.info("Prism binary path resolved to: %s", target_url) # Make sure the binary is executable. - st = os.stat(target_url) - os.chmod(target_url, st.st_mode | stat.S_IEXEC) + try: + st = os.stat(target_url) + os.chmod(target_url, st.st_mode | stat.S_IEXEC) + except PermissionError: + _LOGGER.warning( + 'Could not change permissions of prism binary; invoking may fail if ' + + 'current process does not have exec permissions on binary.') return target_url @staticmethod