Pass variable from python script to C program(command line argument) -
Pass variable from python script to C program(command line argument) -
i here issue : have gui (wxpython), has spinctrl, output of spinctrl must sent c file, take command line argument, whenever execute c file using subprocess accepts value gui spinctrl value must sent instead of manual typing.
my code is:
ps = "password" var1 = self.sc1.getvalue() var2 = self.sc2.getvalue() subprocess.call(['echo xsxsxs | sudo "./license.exe"', str(ps), str(var1), str(var2)],shell = true)
whenever run script doesnot show output/error :(
if remove echo xsxsxs| sudo line 4 , execute show error: "you must root user","invalid password", "segmentation fault".
whenever utilize shell=true
subprocess.popen
(or 1 of convenience wrappers), should pass string way type in shell, not list
.
from docs:
if shell true, recommended pass args string rather sequence.
python c wxpython subprocess wxwidgets
Comments
Post a Comment