Configuring Python for use with Analytics
To configure Python to work with Analytics, you must install a compatible version of Python and add the executable to your system PATH environment variable. You must also set the ACLPYTHONDLL and PYTHONPATH system environment variables.
How it works
To run Python scripts, Analytics must be able to call the Python executable and find the scripts it is instructed to run. Analytics uses the PATH environment variable to locate Python and the PYTHONPATH environment variable to locate scripts.
Install Python version 3.7.9 (32-bit)
- From the Python downloads page, download a version of Python to your computer or the server.
Note
We recommend using Python 3.7.9 because it has been tested and verified to work correctly with Analytics or the Robots Agent.
Any version of Python from 3.3.x onward should also work, however we do not offer the same guarantee of testing and support as we do with version 3.7.9.
- On your computer or the server, double-click the installer.
- In the installer, select Add Python versionNumber to PATH.
- Click Install and follow the on-screen instructions.
- Reboot the computer or the server before running any Python scripts called by an Analytics script.
Set the ACLPYTHONDLL and PYTHONPATH environment variables
- In the C:\ drive of the operating system, create one or more folders to house your Python scripts.
Example C:\python_scripts
- From the operating system, open the System Properties dialog box and click Environment Variables.
- In the System variables section, click New and enter the following variables:
Variable name Variable value PYTHONPATH The full path to the folder(s) you created to house the Python scripts. Separate multiple folder paths with a semi-colon.
Example:
C:\python_scripts;C:\dev;C:\tmp
ACLPYTHONDLL The full path and filename of the Python DLL file in the Python installation folder that you want to use with Analytics or the Robots Agent.
Example:
c:\python_install\python33.dll
If you are using Python 3.3.x, the following restrictions apply:
- Unicode characters are not supported in the path for European platforms
- Extended characters are not supported in the path for Asian platforms
Note
Python adds the DLL to the system folder (c:\windows\system32\python33.dll) rather than the installation folder. You must copy the DLL from the system folder to the installation folder, and use this as the variable value so that Analytics can access the DLL.
You may also need to remove any read only settings from the installation folder.
If you do not set this value, Analytics or the Robots Agent attempts to use the default supported version 3.5.x DLL python35.dll.
- To save the variable, click OK and then in the System Properties dialog box, click OK.
Use Python in Analytics Python functions
From Analytics, use the Analytics Python functions to call functions in scripts that exist in your PYTHONPATH.
Note
If you make any edits to a Python script, you must refresh the view in your Analytics project to use the latest version of the Python script. The simplest way to refresh the view is to close the table you are working with and then re-open it.