PythonShell plugin

The PythonShell plugin offers a CLI interface to a Python shell in OpenCOR’s environment.

Help

$ ./OpenCOR -c PythonShell::help
Commands supported by the PythonShell plugin:
 * Display the commands supported by the PythonShell plugin:
      help
 * Run an interactive Python shell in OpenCOR's environment:
      [python] [<option> ...] [-c <command> | -m <module> | <file> | -] [<argument> ...]
   where
      -c <command> executes a program passed in as a string
      -m <module> runs a library module as a script
      <file> runs a program read from a script file
      - runs a program read from the standard input

Interactive Python shell

$ ./OpenCOR -c PythonShell::python
Python 3.7.5 (default, May 27 2022, 16:06:22)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

From the help section above, we can see that the python command is actually optional, which means that an interactive Python shell can also be launched using:

$ ./OpenCOR -c PythonShell
Python 3.7.5 (default, May 27 2022, 16:06:22)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

OpenCOR comes with the pythonshell[.bat] script, which is an alias to ./OpenCOR -c PythonShell $*. So, a third way to launch an interactive Python shell is:

$ ./pythonshell
Python 3.7.5 (default, May 27 2022, 16:06:22)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Run a Python script

$ ./OpenCOR -c PythonShell::python /path/to/my/python/script.py
...
$ ./OpenCOR -c PythonShell /path/to/my/python/script.py
...
$ ./pythonshell /path/to/my/python/script.py
...