0

I would like to send a command to the interpreter and get the return of this command.

I'm actually using PyRun_String and it's working greatly but I have to pass in args Py_single_input if I want to init a variable like a = 10then I get none. If I want to send a I have to put Py_eval_input in args then I get 10.

So my problem is how I can merge Py_single_input and Py_eval_input to use this both fonction in a same function.

or

Is there another function other than Pyrun_String?

auguyon
  • 15
  • 5
  • But `a=10` _doesn't have a value_ because it is a statement but not an expression. What result would you expect from `a, b = 1, 2`? Or `a[0] = 10`? This is why you can't do `if a=10:` in Python – DavidW Nov 04 '20 at 19:03
  • Thanks but I know that. I wonder I can find a solution to merge both. If I send ```a```, the command know is an expression but if I send ```a = 10```, the command know is a statement. I imagine if it was possible, there wouldn't be that. – auguyon Nov 05 '20 at 08:34

0 Answers0