0.010/29/2019

Article Information

Applies To

HOWTO-1504: Installing Python Engine for use in Workflow

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.

 

Downloading and installing Python

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.

 

Testing

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.