Python 3 Support

I did some searching around OL web and did not find any information on Python3 support within Workflow. Python2 has a planned end-of-life scheduled for 01/01/2020 (https://www.python.org/dev/peps/pep-0373/), so I’ve been attempting to update all Py2 code to Py3 when possible. By chance, can anyone provide some insight?

Thank you.

–Ken

Hi Ken,

My experience with Python is, sadly, pretty limited. However, I was able to install the latest version of Python (3.7) and register it for use in Workflow. I ran a very basic script and it worked fine, just as it did with Python 2.x.

To make sure that the Python 3 features are indeed implemented and available, I ran a basic test: floating point division. In Python 2.7, the result of (3/2) would be 1 (to get the proper result, you’d have had to write (3/2.0) ), whereas in Python 3, the result is 1.5, which is exactly what I got in Workflow. So it seems everything works as expected.

To install and register Python 3 for use with Workflow:

  • Download & install Python 3.7.2 32bits from Python.org
  • Download & install PyWin32 3.7 32bits from Releases · mhammond/pywin32 · GitHub
  • Edit your system path if the installation didn’t do it for you (go to Windows System Properties > Environment Variables > path):
    • add C:\Python37 (this is where I installed Python, adjust the path accordingly)
    • add C:\Python37\Scripts
  • Register Python by running C:\Python37\Lib\site-packages\win32comext\axscript\client\pyscript.py from the command line

That should do it.

For reference, the Python Script I used to test this out is just a basic piece of code that lists all the Groups in the Data Repository:

import win32com.client
import json

myRepo = win32com.client.Dispatch("RepositoryLib.WorkflowRepository")
myGroups = json.loads(myRepo.ListGroups())

for group in myGroups:
         Watch.Log(group,2)

Hope that helps.

Thank you, Phil! I appreciate the quick response. I’m working on our upgrade to PPConnect, so this news will help tremendously.

Best Regards,

–Ken