diff --git a/scripts/update_license_headers.py b/scripts/update_license_headers.py
index 62a166f17e301ad0537ac32d60dcc6a45396c84b..da839ba0aa944f339dadfe8cf65fb1a002476694 100644
--- a/scripts/update_license_headers.py
+++ b/scripts/update_license_headers.py
@@ -87,7 +87,7 @@ def process_file(
 
     temp_file_path = file_path + '.temp'
     replaced = False
-    file_mode = os.stat(file_path)
+    file_stat = os.stat(file_path)
     try:
         with open(file_path, encoding='UTF-8') as source:
             with open(temp_file_path, 'w', encoding='UTF-8') as target:
@@ -104,7 +104,7 @@ def process_file(
         file_updated.write(file_path + '\n')
 
     os.rename(temp_file_path, file_path)
-    os.chmod(file_path, file_mode)
+    os.chmod(file_path, file_stat.st_mode)
 
 def main() -> int:
     with open(FILE_PATH_NO_HEADER, 'w', encoding='UTF-8') as file_no_header: