This procedure explains how to install Python on a Windows system, along with all the requirements that are necessary for Python to be used as a scripting engine in PlanetPress Workflow. The procedure installs the standard distribution of Python. Note that ActivePython may also be used, but some versions have been reported to cause issues and incompatibilities with Workflow, so it is recommended that you uninstall ActivePython and use standard Python instead.
At the time of this writing, the latest version of Python is 3.7. The procedure described below should work with any updates to the engine, simply adjust the version numbers accordingly.
Note that all downloads should be for the 32-bit version as Workflow is itself a 32-bit application. See FAQ-1503: 64-Bit Support in PlanetPress for more details.
add C:\Python37 (Assuming this is where you installed Python. If not, adjust the path accordingly)
add C:\Python37\Scripts
You may have to reboot your system for the path to become effective
Open a Command Line Window (Windows Key + R > CMD)
Type CD C:\Python37\Lib\site-packages\win32comext\axscript\client and press Enter.
Type python pyscript.py and press Enter.
Close the Command Line Window
To run a basic test with the Python Engine, add the following script to a new Workflow process and run it in Step-By-Step mode. Make sure to specify Python in the language menu of the Script Editor:
import win32com.client
import json
myRepo = win32com.client.Dispatch("RepositoryLib.WorkflowRepository")
myGroups = json.loads(myRepo.ListGroups())
if len(myGroups) == 0:
Watch.Log('No groups found in Data Repository',2)
else:
for group in myGroups:
Watch.Log(group,2)
This code prints out a list of all groups in the Data Repository. It allows you to double-check that the Python engine is installed and registered correctly, that it can access COM objects (the Repository) and that it can refer to Workflow-declared objects (the Watch object).
If you're new to Python, check out the Python Tutorial. For more information on scripting in Workflow, check out the Workflow User Guide's Using Scripts chapter.