call python script from PHP index out of range -


i'm calling python script php code, need pass 7 variable: few strings, couple of array , matrix.

i tried use both shell_exec , exec(), same problem:

matrixdata = sys.argv[7] indexerror: list index out of range 

the first thought " passed wrong number of variable ", checking 7. python code:

 listlabel = str(sys.argv[2])  listdata = (sys.argv[1])  typechart = str(sys.argv[3])  name = str(sys.argv[4])  typedata = str(sys.argv[5])  title = str(sys.argv[6])  matrixdata = sys.argv[7] //this matrix 

this php lines call it

//json encoding array: $total = json_encode(compact($listlabel)); $event = json_encode(compact($listdata)); $event = json_encode(compact($matrixdata));   exec("python ../home/path../create_chart.py $total $event $chart $name $typedata $title $matrixdata", $output); //all parameters exist , path correct 

i'm passing 7 arguments, i'm getting 7 arguments. don't understand problem is.

before added last matrix, line working 7 elements, instead of 7, tried 8 elements , 9 instead of 7, no luck.

let me know if can me, thank you.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -