This module evaluates python commands on the fly.
string eval (const string& stringToEvaluate)
eval script
string to eval
if the evaluation has gone wrong
Example in Python :
# PC python is used to call embedded python interpreter pythonBridge from naoqi import ALBroker from naoqi import ALModule from naoqi import ALProxy try: lProxy = ALProxy("ALPythonBridge","127.0.0.1",9559) # no syntax error print lProxy.eval("print('Hello in python')") # get error print lProxy.eval("prfint('Hello in python')") except RuntimeError,e: # catch exception print "error in eval", e exit(1)
AL::ALValue evalReturn (const string& stringToEvaluate)
eval script and return result. evalReturn(2+2) will return 4
string to eval
the result of the evaluation
AL::ALValue evalFull (const string& stringToEvaluate)
evaluates script and returns an informative array.
string to eval
an array containing [return value, exceptions, stdout, stderr]
Example in Python :
# PC python is used to call embedded python interpreter pythonBridge from naoqi import ALBroker from naoqi import ALModule from naoqi import ALProxy try: lProxy = ALProxy("ALPythonBridge","127.0.0.1",9559) # no syntax error print lProxy.evalFull("1+2") # return [3, '', '', ''] # get error print lProxy.evalFull("prfint('Hello in python')") #return ['', "<type 'exceptions.NameError'> name 'prfint' is not defined ", '', ''] # get stdout print lProxy.evalFull("print('Hello in python')") #return ['', '', 'Hello in python ', ''] except RuntimeError,e: # catch exception print "error in eval", e exit(1)
string version ()
Returns the version of the module.
A string containing the version of the module.
AL::ALValue getMethodHelp (const string& methodName)
Retrieves a method's description.
The name of the method.
A structure containing the method's description.
AL::ALValue getModuleHelp ()
Retrieves the module's description.
A structure describing the module.
string getUsage (const string& name)
Gets the method usage string. This summarise how to use the method.
The name of the method.
A string that summarises the usage of the method.