Posted By: Grat
Python bridge - wrong output sample - 06/30/19 09:35
Hi,
I trying the python sample:
output the Sum is -1, but correct is 100
I trying the python sample:
Code
if(!pyStart(0,1)) { printf("Error - Python won't start!"); return; } var Vec[5] = { 0,1,2,3,4 }; pySet("PyVec",Vec,5); pyX("for i in range(5): PyVec[i] *= 10\n"); pyVec("PyVec",Vec,5); int i; printf("\nReturned: "); for(i=0; i<5; i++) printf("%.0f ",Vec[i]); // test a function pyX("def PySum(V):\n Sum = 0.0\n for X in V:\n Sum += X\n return Sum\n\n"); pyX("Result = PySum(PyVec)"); printf("\nSum: %.0f",pyVar("Result"));
output the Sum is -1, but correct is 100