python

python

  • @static

Constructor

python(what, timeoutopt)

Description:
  • Starts/stops a Python session or runs a command.

    • This function is accessible via the aidesys:: prefix.

    • It is not available in the cygwin environment.

    • To gets a value from the python session, you may use a code of the form:

      aidesys::python("start");
      aidesys::python("v = 2 + 3");
      std::string r = aidesys::python("get v"); // => r == "5"
      aidesys::python("stop");
    
    • The aidesys::python("command1"); aidesys::python("command2"); ... sequence is equivalent to the following construct:
      #include <Python.h>
      ../..
      int err = PyRun_SimpleString("command1" "command2");
      aidesys::alert(err != 0, "illegal-state", ..
    
Parameters:
Name Type Attributes Default Description
what string

Either

  • start: starts the wrapping
  • stop: stops the wrapping.
  • get value: returns a python variable as a string, as if printed via the python print() command.
  • or any command to execute.
timeout uint <optional>
0

Optional timeout in milliseconds.