With the compiler version extension, you can display the mapped compiler versions and you can set a new compiler version by executing the script.
# Enable the new python 3 print syntax
from __future__ import print_function
# The path to the project
project_path = r"D:\PythonProjects\GetCompilerVersion.project"
# Clean up any open Project:
if projects.primary:
projects.primary.close()
# Load the project
proj = projects.open(project_path);
print("All compiler versions")
# Get all compiler versions (filtered)
compiler_versions = compiler_settings.get_all_compiler_versions()
# Print all compiler versions (filtered)
for version in compiler_versions:
print (" - OEM mapped version: " + version)
# Get active compiler version
compiler_version = compiler_settings.active_compiler_version
print("Current compiler version:" + compiler_version)
# Set new compiler version
compiler_settings.active_compiler_version = "4.2.0.0"
print("New compiler version: " +
compiler_settings.active_compiler_version)
# Save project
projects.primary.save()