Chapter 26. Miscellaneous Functionality
Prev |  | Next

## Chapter 26. Miscellaneous Functionality

SCons supports a lot of additional functionality that doesn't readily fit into the other chapters.

## 26.1. Verifying the Python Version: the `EnsurePythonVersion` Function

Although the SCons code itself will run on any 3.x Python version (check the release notes for the precise minimum supported release), you are free to make use of Python syntax and modules from later versions when writing your `SConscript` files or your own local modules. If you do this, it's usually helpful to configure SCons to exit gracefully with an error message if it's being run with a version of Python that simply won't work with your code. This is especially true if you're going to use SCons to build source code that you plan to distribute publicly, where you can't be sure of the Python version that an anonymous remote user might use to try to build your software.

SCons provides an `EnsurePythonVersion` function for this. You simply pass it the major and minor versions numbers of the version of Python you require:

    EnsurePythonVersion(3, 8)

And then SCons will exit with the following error message when a user runs it with an unsupported earlier version of Python:

    % scons -Q
    Python 3.7 or greater required, but you have Python 3.6.5

Prev |  | Next
25.2. Simple project | Home | 26.2. Verifying the SCons Version: the `EnsureSConsVersion` Function