bBox_Python3Run( mode; script {; text; param1; ...} )

Parameters:
   mode:
      0 = convert both input and output line endings, wait for output
      1 = skip conversion of carriage returns (the FileMaker end-of-line marker) to new lines
      2 = skip translation of new lines in shell output to carriage returns
      3 = don't translate input or ouput line endings
      4 = run asynchronously (don't wait for output)
      16 = use /usr/local/bin/python3
      32 = combine Python stdout and stderr output
   script: text to be compiled into bytecode

Result:
   text sent to stdout

Error:
   bBox_LastError ("posix")

Script Step:
   bBox Python3 Run [ Mode: Script: Input: Param1: Param2: Param3: ]

––––––––––

First appeared in: 

Examples in demo file: 

Compatibility:   Client, macOS, Server, Ubuntu, WebDirect, WPE

––––––––––

Normally uses the python3 command installed at /usr/bin. On macOS, this requires the installation of Python Foundation's version of Python, on Ubuntu use apt-get to install it. To use alternate version, you may need to create a symlink in /usr/local/bin to your desired binary and add 16 to the mode.

Python modules installed on Linux may not be in the default path. If needed, add the following before you import statement:

import sys
sys.path.append('/usr/local/lib/python3.8/dist-packages')

Use bBoxy_LastError (-3) to get error result. While testing, using a mode of 32 is recommended. This will cause stderr output from Python to be returned as the script step/function result. Otherwise, messages about things like Python syntax errors will be lost, and you will only have the error message returned by bBox_LastError.

These calls are thread safe, so you can safely have multiple Python 3 scripts running at the same time. The script step does not support the Python fm module however — for fm methods you’ll need to use the bBox_PythonExecute or bBox_PythonEval functions.