python

python ( string script , bool[default:true] waitEndOfScript , long timeout ) : string

Executes a Python script.
Remember to install Python on your computer first.

Example



console(python("""
if __name__ == "__main__":
print("Hello from Python.")
"""))


See also

interact
sendCommandLine

Parameters

script

Your python script.
Note: if you're including paths, remember that under Windows you'll need \\ and do a replace(youPath, "\\","\\\\").

waitEndOfScript

Defines whether the function should run synchronously and block the program until the end of the Python script.

timeout

By default, the script will have 5 minutes to run (the function is blocked until the end of this time or until the script ends normally).
If you set the value to null, there is no maximum time limit, and the script must terminate to exit the function. In this case, if an error occurs, you'll have to kill the Grimport process to exit the program.
If you specify a time limit in milliseconds, the script will have this amount of time to run (the function is blocked until the end of this time limit or until the script terminates normally).