Python error when using http post to Flowmailer

The script gives an error:

I checked the syntax, everything is fine:

When I strip the script from Workflow specific stuff, it works like a charm on the commandline:

Other Python scripts run without problems. What is done by Workflow with the execution of a Python script? Might a Python reinstall help?

Hello @sybren.kuperus,

Can you please confirm whether Traceback (most recent call last): is the end of the line being logged? Could you possibly check the logging by opening the ppw*.log file, stored in the directory C:\ProgramData\Objectif Lune\PlanetPress Workflow 8\PlanetPress Watch\Log\, in an application like Notepad?


Adding the error as text to make searching for the error on the forum more easier.

15:26:15.657 [0002] Run script file %{global.ScriptsDir}\getFlowmailerToken.py...
15:26:15.657 [0002] W3602 : Error 0 on line 58, column 0: Python ActiveX Scripting Engine: Traceback (most recent call last):
15:26:15.657 [0002] W3603 : Error running script.
15:26:15.657 [0002] Run Script: W1603 : Plugin failed - 15:26:15 (elapsed time: 00:00:00.105)

Indeed there is more logging in the logfile:

INFO : 15:26:15.552 [0002] Run script file %{global.ScriptsDir}\getFlowmailerToken.py...
ERROR: 15:26:15.657 [0002] W3602 : Error 0 on line 58, column 0: Python ActiveX Scripting Engine: Traceback (most recent call last):
  File "<Script Block >", line 58, in <module>
    r = requests.post(url, auth = HTTPBasicAuth(clientId, secret), data = {"grant_type": "client_credentials", "scope": "api"}, headers = {"Content-Type": "application/x-www-form-urlencoded", "Accept": "application/vnd.flowmailer.v1.12+json"})
  File "C:\Program Files (x86)\Python39\lib\site-packages\requests\api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "C:\Program Files (x86)\Python39\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Program Files (x86)\Python39\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files (x86)\Python39\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files (x86)\Python39\lib\site-packages\requests\adapters.py", line 667, in send
    resp = conn.urlopen(
  File "C:\Program Files (x86)\Python39\lib\site-packages\urllib3\connectionpool.py", line 772, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "C:\Program Files (x86)\Python39\lib\site-packages\urllib3\connectionpool.py", line 295, in _get_conn
    return conn or self._new_conn()
  File "C:\Program Files (x86)\Python39\lib\site-packages\urllib3\connectionpool.py", line 1063, in _new_conn
    raise ImportError(
ImportError: Can't connect to HTTPS URL because the SSL module is not available.
ERROR: 15:26:15.657 [0002] W3603 : Error running script.
ERROR: 15:26:15.657 [0002] Run Script: W1603 : Plugin failed - 15:26:15 (elapsed time: 00:00:00.105)

WPROC: OutputFlowmailer_010JMQLITCNGUC4 (thread id: 1960) complete - 15:26:15 (elapsed time: 00:00:00.105)
1 Like

The SSL is there because commandline pyscript runs without problems? I’m using the same user account the service is running under.

Tip: Please wrap the shared logging in between the following. Otherwise a few characters might have been replaced as they have been applied as styling instead.

After many many hours of trying and searching I found the issue:

Python 3.9 uses OpenSSL 1.1.1n. PP Workflow latest version uses 1.1.1t. When you run in a command prompt Python uses its own 1.1.1n version, but when you run via Workflow the 1.1.1t version is used, causing the error.
Solution: replace the 1.1.1t dll’s in C:\Program Files (x86)\Objectif Lune\PlanetPress Workflow\PlanetPress Watch\Bin with the 1.1.1n version from Python 3.9.
Question remains: WHY doesn’t Workflow use the standard Python installation, where we as users are in control!

Please note that OpenSSL 1.1.1 is EOL!

Python 3.12 has OpenSSL 3.0 however:

  1. this doesn’t work with PP Workflow (???)
  2. PP Workflow uses OpenSSL 1.1.1 from it’s own directory and also needs to be upgraded, however this has to be done in a new release of PP Workflow? Or use the OpenSSL version supplied with the Python installation on the system instead of pushing the PP Workflow version.