def OnClick(self,event):
print "a:", a
os.system('iperf -s -w a')
Here a is displayed correctly. But in the os.system command the value of a is taken as 0.
Could you please help me on this?
def OnClick(self,event):
print "a:", a
os.system('iperf -s -w a')
Here a is displayed correctly. But in the os.system command the value of a is taken as 0.
Could you please help me on this?
You are not passing the value of a, but you are passing a as it is. So, you might want to do this
os.system('iperf -s -w {}'.format(a))
Now, the value of a will be substituted at {}. You can see the difference between both the versions by printing them
print 'iperf -s -w {}'.format(a)
print 'iperf -s -w a'
subprocess.check_outputimport subprocess?os.system('iperf -s -w a')
takes literal a and not the value of the variable. I would use:
cmd = 'iperf -s -w %d' %a
os.system (cmd)