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.3.x or later (32-bit)
- From the Python downloads page, download a version of Python to your computer.
Note
We recommend using Python 3.5 because it has been tested and verified to work correctly with Analytics. Any version of Python from 3.3.x onward should also work with Analytics, but versions other than 3.5 are not guaranteed to work in every area.
- On your machine, double-click the installer.
- In the installer, select Add Python versionNumber to PATH.
- Click Install and follow the on-screen instructions.
- Reboot the machine before running any Python scripts from Analytics.
Set the ACLPYTHONDLL and PYTHONPATH environment variables
- In your Windows operating system, create one or more folders to house your Python scripts.
ExampleC:\python_scripts.
- From your Windows 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 Example PYTHONPATH The full path to the folder(s) you created to house the Python scripts. Separate multiple folder paths with a semi-colon. 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.
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 attempts to use the default supported version 3.5.x DLL python35.dll.
c:\python_install\python33.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.