pyexec
pyexec |
Purpose
Synopsis
procedure pyexec(source: string)
Argument
|
source
|
Python source code stored in a string.
|
Example
The following model runs a Python script from a string:
model "Python script from string"
uses "python3"
writeln("Python version:")
pyexec("import platform; print(platform.python_version())")
end-model
Further information
1. The function compiles and runs a Python script from a string buffer and waits for its termination. It is a fatal error if the compilation fails or a Python run-time error occurs.
2. Use the Python I/O driver to transfer data between Mosel and Python. See Section
Driver python for more details.
Related topics
